New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
integer overflow in _json.encode_basestring_ascii #67558
Comments
# static PyObject * #
# % ./python -V
# Python 3.4.1
#
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 2013 i686 i686 i386 GNU/Linux
#
from _json import encode_basestring_ascii as enc
s="\uffff"*int((2**32)/6+1)
enc(s) |
New changeset 8699b3085db3 by Benjamin Peterson in branch '3.3': New changeset 4f47509d7417 by Benjamin Peterson in branch '3.4': New changeset 02aeca4974ac by Benjamin Peterson in branch 'default': |
"\uffff"*((2**32)//6 + 1) is calculated at compile time. This requires much memory and can cause swapping. May be this was a cause of failing tests on some buildbots: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.x%203.x/builds/2623/steps/test/logs/stdio Traceback (most recent call last):
File "/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/test/__main__.py", line 3, in <module>
regrtest.main_in_temp_cwd()
File "/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/test/regrtest.py", line 1564, in main_in_temp_cwd
main()
File "/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/test/regrtest.py", line 738, in main
raise Exception("Child error on {}: {}".format(test, result[1]))
Exception: Child error on test_json: Exit code -9
*** [buildbottest] Error code 1 At least my computer hanged on first run of this test. To prevent computing this string constant at compile time you can use a variable. And '\x00' can be used instead of '\uffff', it needs less memory. |
New changeset 5c730d30ffbc by Benjamin Peterson in branch '3.3': |
I noticed that this is only fixed for python 3.3 and 3.4, not for 2.7. Is that intentional? If so, why? |
New changeset 6fa0ebfdc136 by Benjamin Peterson in branch '2.7': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: