[issue3367] Uninitialized value read in parsetok.c

STINNER Victor report at bugs.python.org
Mon Mar 26 01:20:33 CEST 2012


STINNER Victor <victor.stinner at gmail.com> added the comment:

I'm unable to reproduce this error:
----------
$ valgrind --db-attach=yes --suppressions=Misc/valgrind-python.supp ./python 
Python 3.3.0a1+ (default:0554183066b5, Mar 20 2012, 10:47:41) 
...
==20258== Invalid read of size 8
==20258==    at 0x4C9F6F: sys_update_path (sysmodule.c:1742)
==20258==    by 0x4CA268: PySys_SetArgvEx (sysmodule.c:1830)
...
----------

My try:
----------
$ ./configure --with-pydebug --with-valgrind && make
(...)
$ valgrind --suppressions=Misc/valgrind-python.supp ./python 
==10692== Memcheck, a memory error detector
==10692== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==10692== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==10692== Command: ./python
==10692== 
Python 3.3.0a1+ (default:f8d01c8baf6a+, Mar 26 2012, 01:12:33) 
[GCC 4.6.2 20111027 (Red Hat 4.6.2-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+1
2
>>> 
==10692== 
==10692== HEAP SUMMARY:
==10692==     in use at exit: 2,896,586 bytes in 14,491 blocks
==10692==   total heap usage: 86,344 allocs, 71,853 frees, 12,370,023 bytes allocated
==10692== 
==10692== LEAK SUMMARY:
==10692==    definitely lost: 0 bytes in 0 blocks
==10692==    indirectly lost: 0 bytes in 0 blocks
==10692==      possibly lost: 2,779,467 bytes in 14,287 blocks
==10692==    still reachable: 117,119 bytes in 204 blocks
==10692==         suppressed: 0 bytes in 0 blocks
==10692== Rerun with --leak-check=full to see details of leaked memory
==10692== 
==10692== For counts of detected and suppressed errors, rerun with: -v
==10692== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
----------

sysmodule.patch	looks to be useless: n is not used if argc <= 0.

At the revision 0554183066b5, sysmodule.c:1742 is the following line:
    if (argc > 0) {
but sysmodule.c:1830 is:
    if (av == NULL)
whereas it should be:
        sys_update_path(argc, argv);

Stephan: can you redo the Valgrind test on copy the exact line where the invalid read occurs (in sysmodule.c).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3367>
_______________________________________


More information about the Python-bugs-list mailing list