-
Notifications
You must be signed in to change notification settings - Fork 458
Open
Labels
Description
The below code triggers an exception with the following message: ValueError: invalid literal for int() with base 10: '\x0c'
. This occurs in _process_keyword_line
at line 251 in pofile.py
as a result of a failure to check the validity of an integer conversion.
import io
from babel.messages.pofile import read_po
data = io.StringIO("msgstr[\x0c]")
read_po(data)
Version
2.17.0
Trace report
Traceback (most recent call last):
File "rep.py", line 5, in <module>
read_po(data)
File "lib/python3.10/site-packages/babel/messages/pofile.py", line 406, in read_po
parser.parse(fileobj)
File "lib/python3.10/site-packages/babel/messages/pofile.py", line 331, in parse
self._process_message_line(lineno, line)
File "lib/python3.10/site-packages/babel/messages/pofile.py", line 221, in _process_message_line
self._process_keyword_line(lineno, line, obsolete)
File "/lib/python3.10/site-packages/babel/messages/pofile.py", line 251, in _process_keyword_line
idx = int(idxarg[:-1]) if has_bracket else 0
ValueError: invalid literal for int() with base 10: '\x0c'