[issue22207] Test for integer overflow on Py_ssize_t: explicitly cast to size_t

STINNER Victor report at bugs.python.org
Mon Aug 25 03:22:09 CEST 2014


STINNER Victor added the comment:

> I think there are too many changes. Here is simpler patch which get rid of all warnings in Objects/unicodeobject.c on my computer (gcc 4.6.3, 32-bit Linux).

The purpose of my patch is not to make the compiler quiet, but to ensure that negative lengths are handled correctly: Python must raise an error if a length is negative.

For example, _PyUnicode_DecodeUnicodeInternal() doesn't check currently if the size is negative. I don't know exactly what happens if you pass a negative size.

----------

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


More information about the Python-bugs-list mailing list