[New-bugs-announce] [issue18216] gettext doesn't check MO versions

Jakub Wilk report at bugs.python.org
Fri Jun 14 22:34:41 CEST 2013

New submission from Jakub Wilk:

The MO file format specification[0] reads:
"A program seeing an unexpected major revision number should stop reading the MO file entirely"
But Python doesn't pay attention to versions at all.

As a test-case I attached a MO file with a bogus major revision number. msgunfmt correcly rejects such a file:

$ msgunfmt messages.mo 
msgunfmt: file "messages.mo" is not in GNU .mo format

Yet Python opens it happily:

>>> import gettext
>>> t = gettext.GNUTranslations(open("messages.mo", "rb"))
>>> t.gettext("foo")

[0] http://www.gnu.org/software/gettext/manual/html_node/MO-Files.html

components: Library (Lib)
files: messages.mo
messages: 191151
nosy: jwilk
priority: normal
severity: normal
status: open
title: gettext doesn't check MO versions
Added file: http://bugs.python.org/file30587/messages.mo

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list