Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue5765] stack overflow evaluating eval("()" * 30000)

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Aug 17, 2012, 10:37 AM

Post #1 of 7 (70 views)
Permalink
[issue5765] stack overflow evaluating eval("()" * 30000)

Mark Shannon added the comment:

I've re-reviewed Andrea's patch (I was looking over Andrea's shoulder at the EuroPython sprint when he wrote it).

It looks good and applies cleanly.
Could someone commit it please.

----------
nosy: +Mark.Shannon

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 19, 2012, 2:05 PM

Post #2 of 7 (62 views)
Permalink
[issue5765] stack overflow evaluating eval("()" * 30000) [In reply to]

Francisco Martín Brugué added the comment:

Just curiosity: how relate the magic numbers 100000 and 2000 in test_compiler_recursion_limit to recursion_depth and recursion_limit

Thanks!

----------
nosy: +francismb

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 19, 2012, 3:27 PM

Post #3 of 7 (62 views)
Permalink
[issue5765] stack overflow evaluating eval("()" * 30000) [In reply to]

Antoine Pitrou added the comment:

Indeed I don't like the introduction of COMPILER_STACK_FRAME_SCALE.
Re-using the existing infrastructure would be much easier to maintain.
The default recursion limit is 1000, which should cover any non-pathological code, IMHO.

----------
nosy: +pitrou
stage: -> patch review
versions: -Python 2.6, Python 3.1, Python 3.4

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 19, 2012, 3:35 PM

Post #4 of 7 (62 views)
Permalink
[issue5765] stack overflow evaluating eval("()" * 30000) [In reply to]

Amaury Forgeot d'Arc added the comment:

The patch is incomplete: the VISIT macro contains a "return 0;" and in this case st->recursion_depth is not decremented.
OTOH errors are never caught, so it's not necessary to do any cleanup in case of errors.
Here is a simplified patch.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 19, 2012, 3:35 PM

Post #5 of 7 (62 views)
Permalink
[issue5765] stack overflow evaluating eval("()" * 30000) [In reply to]

Changes by Amaury Forgeot d'Arc <amauryfa [at] gmail>:


Added file: http://bugs.python.org/file26903/compiler_recursion_limit_check-2.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 19, 2012, 11:54 PM

Post #6 of 7 (62 views)
Permalink
[issue5765] stack overflow evaluating eval("()" * 30000) [In reply to]

Andrea Griffini added the comment:

I missed all the macrology present :-( ... the following is a patch that takes it into account (also defines a VISIT_QUIT macro to make more visible the exit points). The handling has been also extended to visit_stmt because the macros are shared.

Of course all this makes sense assuming that a cleanup in case of error is indeed desired...

BTW: shouldn't be all those statement macros of the "do{...}while(0)" form instead of just being wrapped in "{}" ? I see potential problems with if/else...

----------
Added file: http://bugs.python.org/file26913/compiler_recursion_limit_check_2.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 20, 2012, 12:00 AM

Post #7 of 7 (61 views)
Permalink
[issue5765] stack overflow evaluating eval("()" * 30000) [In reply to]

Andrea Griffini added the comment:

On Mon, Aug 20, 2012 at 12:27 AM, Antoine Pitrou <report [at] bugs> wrote:
> Indeed I don't like the introduction of COMPILER_STACK_FRAME_SCALE.
> Re-using the existing infrastructure would be much easier to maintain.
> The default recursion limit is 1000, which should cover any non-pathological code, IMHO.

I submitted a new version with the scale lowered to 3.

Using a lower value (e.g. 1) however makes "test_extended_args" fail
(the test tries to compile an expression with 2500+ terms).

If it's ok to make that test to throw instead then the whole scaling
could be removed.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.