segfault grabbing attributes off of objects that implement __getattribute__ #6

Open
teepark opened this Issue Dec 8, 2010 · 2 comments

2 participants

@teepark

_namemapper.c:PyNamemapper_valueForName calls PyObject_GetAttrString and doesn't check its return value for NULL. It does check PyErr_Occurred(), but that isn't being triggered in this case (which looks like a bug in the python c api -- I was getting this sporadically on a live service running python 2.4.6).

It should be checking for NULL as well and setting a python error and returning NULL in that case.

We worked around this by overriding __getattr__ instead of __getattribute__ (which should have been done in the first place), but the python issue, not protected against by cheetah, is still there.

@rtyler
Owner

Mind checking out SHA: e835293 to see if that's sufficient?

@teepark

the only place I've seen it happen was at work, and we got rid of our __getattribute__ usage there (and I'm not sure how folks would feel about reintroducing it to test cheetah), but on my own time I'll try and write up a repro script.

@rtyler rtyler added a commit that referenced this issue Apr 23, 2011
@rtyler Check our call to PyObject_GetAttrString() to make sure it returns a …
…non-NULL value

Should resolve issue: #6

Change-Id: Ie1fd42a9719d50e0baa600e3563ac50159201dc9
e835293
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment