[New-bugs-announce] [issue2298] Patch for "string without null bytes" check in getargs.c

Douglas Greiman report at bugs.python.org
Sun Mar 16 07:00:40 CET 2008


New submission from Douglas Greiman <dgreiman at users.sourceforge.net>:

Code in getargs.c:convertsimple incorrectly uses PyUnicode_GetSize
instead of PyString_GET_SIZE when checking whether a bytes object
(encoded string) contains a null byte.

To reproduce: __import__('\u0080')
Incorrect behavior:
  TypeError: __import__() argument 1 must be string without null bytes,
not str
Correct behavior: 
  ImportError

Note the lack of null bytes:
  >>> '\u0080'.encode('utf-8')
  b'\xc2\x80'

----------
components: Interpreter Core
files: py3k-getargs-null-bytes-20080315.diff
keywords: patch
messages: 63571
nosy: dgreiman
severity: normal
status: open
title: Patch for "string without null bytes" check in getargs.c
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file9679/py3k-getargs-null-bytes-20080315.diff

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2298>
__________________________________


More information about the New-bugs-announce mailing list