[issue8651] "s#" and friends can silently truncate buffer length

Antoine Pitrou report at bugs.python.org
Fri May 7 19:24:56 CEST 2010


New submission from Antoine Pitrou <pitrou at free.fr>:

When PY_SSIZE_T isn't defined and a format such as "s#" receives an object whose length fits in a Py_ssize_t but not in an int, the buffer length is silently truncated:

>>> s = 'x' * (4 * 1024**3 + 100)
>>> t = zlib.compress(s, 1)
>>> len(t)
12
>>> len(zlib.decompress(t))
100

(from issue8650)

----------
components: Interpreter Core
messages: 105217
nosy: haypo, loewis, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: "s#" and friends can silently truncate buffer length
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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


More information about the Python-bugs-list mailing list