[mod_python] inspect.getmembers(req) segfaults

Martin Devera devik at cdi.cz
Fri Dec 9 09:23:16 EST 2005


>> code:
>> from mod_python import apache
>> import os
>> import inspect
>>
>> def handler(req):
>>          req.content_type = "text/plain"
>>          m = inspect.getmembers(req);
>>          req.write("PID "+str(os.getpid())+" "+str(1))
>>
>>          return apache.OK
>>
>> getmembers line coredumps apache child.
> 
> Is even easier than that. Simply access 'req.boundary' and it crashes.
> 
> The code contains:
> 
>     {"boundary",     (getter)getreq_recmbr, NULL, "Multipart/byteranges boundary", "boundary"},
> 
> in the request_getsets[] array, but there is no definition of 'boundary' in
> the request_rec_mbrs[] array. As a consequence, when you access it, it
> will crash.
> 
> The 'boundary' line therefore needs to be deleted from the source as it
> appears to serve no purpose.
> 
> I'll log a bug report.

Hello Graham,

I fixed the boundary problem temporarily and found another. And it
seems to be harder (I'm looking at it in GDB for 3 hours now):

def handler(req):
         req.content_type = "text/plain"
         req.write("EE\n")
         a = getattr(req,"allowed_methods");
	return apache.OK

Coredumps in getreq_rec_ml...

Martin


More information about the Mod_python mailing list