]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Backport stringobject.c 2.194 and unicodeobject.c 2.172:
authorGuido van Rossum <guido@python.org>
Fri, 11 Oct 2002 00:47:20 +0000 (00:47 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 11 Oct 2002 00:47:20 +0000 (00:47 +0000)
commitd9ddf59d28dd17f4a3aecf5e1964ae849805cf48
treea8c07733a2d91a24fd519cf353b81e7e4938d48f
parentebc6a65f935df1070ebc06efc0277adc3e0fe742
Backport stringobject.c 2.194 and unicodeobject.c 2.172:

Fix a nasty endcase reported by Armin Rigo in SF bug 618623:
'%2147483647d' % -123 segfaults.  This was because an integer overflow
in a comparison caused the string resize to be skipped.  After fixing
the overflow, this could call _PyString_Resize() with a negative size,
so I (1) test for that and raise MemoryError instead; (2) also added a
test for negative newsize to _PyString_Resize(), raising SystemError
as for all bad arguments.

An identical bug existed in unicodeobject.c, of course.
Objects/stringobject.c
Objects/unicodeobject.c