[mod_python] Empty URL query elements causing mod_python 2.7.x and 3.0.x to seg fault

Matt Hoskins matt at nipltd.com
Mon Nov 10 11:34:28 EST 2003

I believe that mod python 2.7.8 and 3.0.3 (and possibly the latest 3.1,
although I haven't tested them) can be made to lead to a segmentation
fault under unix (and the equivilent under win32) if you have an empty
query string element on the url. I don't have a debug build of
python/apache/etc, but it seems to be during a python_finalize that
things actually explode.

So the most simple case is:

It'll explode with any empty query string component I believe. I'm
guessing it's the fact that the length of the whole element is 0 that's
upsetting things, as the following doesn't cause things to go
horribly wrong (and you correctly get an entry with an empty key):


As I'm not up to speed on python innards I don't know exactly why it's
getting upset. Should be easy to hack a fix to just skip entirely empty
entries, but the correct fix I guess would add a key/value pair of empty
strings to the url argument dictionary (why anyone would care about such
an entry I don't know ;).

I've had this error occur with apache 1.3.28/mod python 2.7.8/python
2.2.3 under linux and windows, and apache 2.0.47/mod python 3.0.3/python
2.3.2 under linux.


More information about the Mod_python mailing list