[
http://issues.apache.org/jira/browse/MODPYTHON-187?page=comments#action_12431530
]
Jim Gallacher commented on MODPYTHON-187:
-----------------------------------------
I've audited tableobject.c for other lines where NULL is being passed to
PyString_FromString and found a few functions that may segfault if they are
called in the post read request phase where SCRIPT_FILENAME is NULL.
Line numbers are for version 3.3.0-dev-20060827, r437300.
line 178 in table_repr()
PyString_ConcatAndDel(&s, PyString_FromString(elts[i].val));
line 366 in function table_values()
PyObject *val = PyString_FromString(elts[i].val);
line 792 in function table_traverse()
PyObject *v = PyString_FromString(elts[i].val);
line 845 in function select_value()
return PyString_FromString(elts->val);
We should audit all our code to make sure we are not making the same mistake
with PyString_FromString elsewhere.
> Hang on subscripted access to request.subprocess_env.
> -----------------------------------------------------
>
> Key: MODPYTHON-187
> URL: http://issues.apache.org/jira/browse/MODPYTHON-187
> Project: mod_python
> Issue Type: Bug
> Components: core
> Affects Versions: 3.2.10
> Environment: Apache: 2.0.59
> ModPython: 3.2.10
> Python: 2.4
> OS: Windows Server 2003
> Reporter: Alan Kennedy
> Attachments: MP187-2006-08-28-jgallacher-1.diff
>
>
> When subscripted access is used to access variable 'SCRIPT_FILENAME' in the
> request.subprocess_env table/mapping, the code hangs.
> The following snippet illustrates the problem.
> # -=-=-=-=-=-=
> def postreadrequesthandler(request):
> request.add_common_vars()
> value = request.subprocess_env['SCRIPT_FILENAME'] # This hangs
> # value = request.subprocess_env.get('SCRIPT_FILENAME')# This works
> return apache.OK
> # -=-=-=-=-=-=
> The strange thing is that the .get() access works fine: only the subscript
> hangs?
> If anyone is wondering about a use-case, I don't actually have one. I was
> just iterating over the contents of the request.subprocess_env using a for
> loop (code below), and found that the code hung when accessing
> 'SCRIPT_FILENAME', and not for any other variable.
> # -=-=-=
> request.add_common_vars()
> d = {}
> for sek in request.subprocess_env.keys():
> d[sek] = request.subprocess_env[sek]
> # -=-=-=
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira