Issue Details (XML | Word | Printable)

Key: MODPYTHON-99
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Jim Gallacher
Reporter: Jim Gallacher
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

accessing some request or server object members causes a segfault

Created: 10/Dec/05 07:46 AM   Updated: 05/Mar/06 03:00 PM
Return to search
Component/s: core
Affects Version/s: 3.2.7
Fix Version/s: 3.2.7

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works md-20051209.diff 2005-12-10 07:49 AM Jim Gallacher 1 kB

Resolution Date: 18/Dec/05 02:32 AM


 Description  « Hide
Martin Devara discovered a segfault when accessing some request object members. For example:

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

Futher investigation revealed problems with several getter functions in requestobject.c and serverobject.c. The root of the problem seems to be pointer dereferencing errors in the getter code. The affected functions and the members which use them are:

src/requestobject.c
    getreq_rec_ml
        allowed_methods

    getreq_rec_ah
        content_languages
        allowed_xmethods

src/serverobject.c
    getsrv_recmbr_ah
        names
        wild_names

Martin has provided a patch to fix the bug.

(Thanks to Martin for tracking this down and providing the fix.)


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #357352 Sat Dec 17 17:31:35 UTC 2005 jgallacher Ref MODPYTHON-99
Fixed segfault bug which occured when some request or server object
members were accessed. Affected members are:

  server.names
  server.wild_names
  req.allowed_xmethods
  req.allowed_methods
  req.content_languages

In util.c, changed tuple_from_array_header() and tuple_from_method_list()
to return an empty tuple rather than None when there are 0 elements.

Changed unit tests to check for empty tuple for:
  req.allowed_methods
  req.allowed_xmethods

Added unit tests for:
  server.names
  server.wildnames
  req.content_language
Files Changed
MODIFY /httpd/mod_python/trunk/test/htdocs/tests.py
MODIFY /httpd/mod_python/trunk/src/serverobject.c
MODIFY /httpd/mod_python/trunk/src/util.c
MODIFY /httpd/mod_python/trunk/src/requestobject.c
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/__init__.py
MODIFY /httpd/mod_python/trunk/src/include/mpversion.h