Issue 1590036: getattr = getattr crash (original) (raw)

Created on 2006-11-03 16:44 by ferringb, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
getattr.patch nnorwitz,2006-11-04 19:40 v1
Messages (4)
msg30438 - (view) Author: Ferringb (ferringb) * Date: 2006-11-03 16:44
class c(object):__getattr__ = getattr c().spam 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.
msg30439 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-11-04 19:40
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.
msg30440 - (view) Author: Ferringb (ferringb) * Date: 2006-11-05 03:57
Logged In: YES user_id=874085 can do the same trick with hasattr also (same type of fix)...
msg30441 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2006-11-05 09:30
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.
History
Date User Action Args
2022-04-11 14:56:21 admin set github: 44192
2006-11-03 16:44:20 ferringb create