[ python-Bugs-1590036 ] __getattr__ = getattr crash

SourceForge.net noreply at sourceforge.net
Sun Nov 5 10:30:48 CET 2006


Bugs item #1590036, was opened at 2006-11-03 16:44
Message generated for change (Comment added) made by arigo
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1590036&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
>Status: Closed
>Resolution: Duplicate
Priority: 6
Private: No
Submitted By: Brian Harring (ferringb)
Assigned to: Armin Rigo (arigo)
Summary: __getattr__ = getattr crash

Initial Comment:
class c(object):__getattr__ = getattr
c().spam

<segfault from overflowing the c stack>

Now granted... it's retarded to attempt this.  But out
of curiousity, I decided to be the retard, and noticed
the interpreter crashes instead of triggering a
RuntimeError for recursion.

As far as I know, getattr is instrumented with
Py_EnterRecursiveCall and Py_LEaveRecursiveCall... so a
bit curious as to how it's occuring.

----------------------------------------------------------------------

>Comment By: Armin Rigo (arigo)
Date: 2006-11-05 09:30

Message:
Logged In: YES 
user_id=4771

This is a particular case of bug #1202533.

With Brett we arrived at a patch in #1202533 which
should solve a family of similar problems.  Can you
check that it also solves the __getattr__=getattr
attack?  If so, we should check in Brett's patch.

----------------------------------------------------------------------

Comment By: Brian Harring (ferringb)
Date: 2006-11-05 03:57

Message:
Logged In: YES 
user_id=874085

can do the same trick with hasattr also (same type of fix)...

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-11-04 19:40

Message:
Logged In: YES 
user_id=33168

The attached patch fixes this problem.  However, I'm
concerned there are more places like this.  I hope Armin has
some ideas if more things are needed to fix this problem.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1590036&group_id=5470


More information about the Python-bugs-list mailing list