[ python-Bugs-1562308 ] uninitialized memory read in parsetok()

SourceForge.net noreply at sourceforge.net
Wed Sep 20 19:49:57 CEST 2006


Bugs item #1562308, was opened at 2006-09-20 08:50
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1562308&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Luke Moore (lukemoore)
Assigned to: Nobody/Anonymous (nobody)
Summary: uninitialized memory read in parsetok()

Initial Comment:
When running python2.5 under valgrind and running
    exec ""
valgrind issues the following warning:

==6661== Conditional jump or move depends on
uninitialised value(s)
==6661==    at 0x403EAF3: parsetok (parsetok.c:189)
==6661==    by 0x40ED673: PyParser_ASTFromString
(pythonrun.c:1354)
==6661==    by 0x40EF852: PyRun_StringFlags
(pythonrun.c:1225)
==6661==    by 0x40CB7FF: PyEval_EvalFrameEx (ceval.c:4202)
==6661==    by 0x40CC8E5: PyEval_EvalCodeEx (ceval.c:2833)
==6661==    by 0x40CCA74: PyEval_EvalCode (ceval.c:494)
==6661==    by 0x40EF3A1: PyRun_InteractiveOneFlags
(pythonrun.c:1264)
==6661==    by 0x40EF5A2: PyRun_InteractiveLoopFlags
(pythonrun.c:714)
==6661==    by 0x40EF6CA: PyRun_AnyFileExFlags
(pythonrun.c:683)
==6661==    by 0x40F930D: Py_Main (main.c:496)
==6661==    by 0x8048591: main (in /usr/bin/python2.5)

Valgrind does not give warnings when doing the same
thing with python2.4.3.

After further investigation, it looks like
tok->line_start is uninitialized.  Initializing to null
in tok_new() removes the valgrind warning, but I have
no idea if this is the correct fix.

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-09-20 10:49

Message:
Logged In: YES 
user_id=33168

Thanks for the report.

What is the python code that caused this warning to be
generated?  I've run valgrind with the standard tests and
don't recall this error.  Without looking at the code, the
proposed fix seems to make sense (though from the name, I
would have guessed that line_start is an int rather than a
pointer).

Also, what system and compiler are you using and how did you
build python?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1562308&group_id=5470


More information about the Python-bugs-list mailing list