Ezio Melotti <ezio.melo...@gmail.com> added the comment:

Attached patch fixes the issues. The patch includes 6 tests that caused a 
segfault and that now raise a "RuntimeError: maximum recursion depth exceeded" 
error, matching the behavior of the Python version.

The recursion happen because scan_once_str/unicode might call 
_parse_object_str/unicode (for objects/dicts) and _parse_array_str/unicode (for 
arrays/lists), and these functions might call scan_once_str again for their 
inner elements.
To fix the problem I added Py_Enter/LeaveRecursiveCall around the calls to 
_parse_object_str and _parse_array_str in scan_once_str/unicode.

For some reason the message raised with json.loads('{"a":' * 100000 + '1' + '}' 
* 100000), is a generic "maximum recursion depth exceeded while calling a 
Python object", but that's probably not too important.
The other messages work fine.

----------
keywords: +patch
nosy: +benjamin.peterson, georg.brandl
priority: high -> release blocker
stage: needs patch -> commit review
Added file: http://bugs.python.org/file21911/issue12017.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12017>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to