[issue16335] Integer overflow in unicode-escape decoder
STINNER Victor
report at bugs.python.org
Wed Oct 31 23:08:32 CET 2012
STINNER Victor added the comment:
I have 12 GB of RAM. Let's test.
$ ./python
Python 3.4.0a0 (default:8573a86c11b5+, Oct 31 2012, 22:17:00)
[GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] on linux
>>> x=(b'\\N{WHITE SMILING FACE' + b'x' * 2**32 + b'}')
>>> len(x)
4294967318
>>> y=x.decode('unicode-escape')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError
There is no crash, but it would be better to get a SyntaxError("(unicode error) 'unicodeescape' codec can't decode bytes in position 0-6: unknown Unicode character name") instead.
I propose to only fix this issue in Python 3.4.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16335>
_______________________________________
More information about the Python-bugs-list
mailing list