[mod_python] inspect.getmembers(req) segfaults

Graham Dumpleton grahamd at dscpl.com.au
Thu Dec 8 00:20:05 EST 2005

Martin Devera wrote ..
> Hello,
> I just started to play with mod_python and managed it to
> coredump.
> It is:
> Apache/2.0.53 (Unix) mod_ssl/2.0.53 OpenSSL/0.9.7b PHP/5.0.5 
> mod_python/3.2.5b Python/2.4.2 , prefork mpm
> I used .htaccess:
> SetHandler mod_python
> PythonHandler testh
> PythonDebug On
> 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.


More information about the Mod_python mailing list