Commit 049cd6b
committed
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.
Will backport to 2.2.2.1 parent f689b88 commit 049cd6b
2 files changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3319 | 3319 | | |
3320 | 3320 | | |
3321 | 3321 | | |
3322 | | - | |
| 3322 | + | |
3323 | 3323 | | |
3324 | 3324 | | |
3325 | 3325 | | |
| |||
3959 | 3959 | | |
3960 | 3960 | | |
3961 | 3961 | | |
3962 | | - | |
| 3962 | + | |
3963 | 3963 | | |
3964 | 3964 | | |
3965 | 3965 | | |
| 3966 | + | |
| 3967 | + | |
| 3968 | + | |
| 3969 | + | |
3966 | 3970 | | |
3967 | 3971 | | |
3968 | 3972 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
6483 | 6483 | | |
6484 | 6484 | | |
6485 | 6485 | | |
6486 | | - | |
| 6486 | + | |
6487 | 6487 | | |
6488 | 6488 | | |
6489 | 6489 | | |
| 6490 | + | |
| 6491 | + | |
| 6492 | + | |
| 6493 | + | |
6490 | 6494 | | |
6491 | 6495 | | |
6492 | 6496 | | |
| |||
0 commit comments