[issue10308] Modules/getpath.c bugs

Hallvard B Furuseth report at bugs.python.org
Thu Nov 4 12:27:44 CET 2010


New submission from Hallvard B Furuseth <h.b.furuseth at usit.uio.no>:

Patches for getpath.c in Python 2.7 and 3.2a3:

2.7 chunk#2: copy_absolute() would use uninitialized data if getcwd()
failed.  The fix is equivalent to what 3.2a3 does.

3.2a3 chunk#2: search_for_exec_prefix() did 'unsigned value >= 0' on the
PyUnicode_AsWideChar() result.  (The fix just renames n to k of signed
type, and moves the variables.  An outer uninitialized 'size_t n' is in
scope, so renaming the inner n to k leaves 'n=fread()' still a size_t.)

Chunk #1, both versions: Fix an unlikely 'n+k' wraparound bug while I'm
at it.  The code has just checked that MAXPATHLEN-n will not wrap.

----------
files: getpath.diff
keywords: patch
messages: 120390
nosy: hfuru
priority: normal
severity: normal
status: open
title: Modules/getpath.c bugs
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file19486/getpath.diff

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


More information about the Python-bugs-list mailing list