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

SourceForge.net noreply at sourceforge.net
Thu Sep 21 06:15:58 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 21:15

Message:
Logged In: YES 
user_id=33168

The proposed fix should be made, but I can't reproduce the
problem.  That bugs me.  I'm running valgrind 3.2.0, what
version are you running?  I tried with gcc 3.3.x on x86 and
gcc 3.4.x and 4.1.1 on amd64.  Both are on gentoo.

Have you run the entire regression suite with valgrind?  I
did, but given I'm not seeing these problems, I wonder if
there might be issues lurking.  

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

Comment By: Luke Moore (lukemoore)
Date: 2006-09-20 11:08

Message:
Logged In: YES 
user_id=1437974

Running the python statement
    exec ""
in the interactive shell will trigger the warning for me.

I'm running Debian unstable, and can reproduce the problem
with its RC1 python2.5 package built with gcc 4.1:

Python 2.5c1 (r25c1:51305, Aug 19 2006, 18:23:29)
[GCC 4.1.2 20060814 (prerelease) (Debian 4.1.1-11)] on linux2

I can also reproduce the problem with my own build of the
official 2.5 release with built gcc 4.0:

Python 2.5 (r25:51908, Sep 19 2006, 15:38:29)
[GCC 4.0.4 20060904 (prerelease) (Debian 4.0.3-7)] on linux2

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

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