This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: cgitb.scanvars fails
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, rgbecker
Priority: normal Keywords:

Created on 2004-06-05 08:59 by rgbecker, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cgitb_scanvars_bug.py rgbecker, 2004-06-05 13:02 demonstrate cgitb scanvars bug
python-2.4a0-966992.patch rgbecker, 2004-06-05 13:06 patch against Pytho-2.4a0 to fix 966992
Messages (3)
msg21037 - (view) Author: Robin Becker (rgbecker) Date: 2004-06-05 08:59
Under certain circumstances cgitb.scanvars fails with
because of an unititialized value variable. This bug is
present in 2.3.3 and 2.4a0.

The following script demonstrates
#####start
import cgitb;cgitb.enable()

def err(L):
    if 'never' in L:
        return
    if 1: print \
    '\n'.join(L)
    v=2

err(['',None])
#####finish

when run this results in mangled output because scanvars
attempts to evaluate '\n'.join(L) where L=['',None]. A
fix is to set value=__UNDEF__ at the start of scanvars.

Index: cgitb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v
retrieving revision 1.11
diff -r1.11 cgitb.py
63c63
<     vars, lasttoken, parent, prefix = [], None, None, ''
---
>     vars, lasttoken, parent, prefix, value = [],
None, None, '', __UNDEF__
msg21038 - (view) Author: Robin Becker (rgbecker) Date: 2004-06-05 13:35
Logged In: YES 
user_id=6946

The script cgitb_scanvars_bug.py produces mangled output
under 2.3.3 and 2.4a0. The error is caused by an error
during evaluation in cgitb.scanvars. I believe a fix is to
intialize value to __UNDEF__.

Patch python-2.4a0-966992.patch appears to fix in 2.3.3 and
2.4a0. There may be other ways in which scanvars can error,
but I haven't found them yet :(
msg21039 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2004-06-05 19:16
Logged In: YES 
user_id=11375

Applied; thanks!
History
Date User Action Args
2022-04-11 14:56:04adminsetgithub: 40348
2004-06-05 08:59:28rgbeckercreate