Issue 2629: _Py_ForgetReference crash when called from _PyUnicode_New on MemoryError (original) (raw)

Issue2629

Created on 2008-04-14 02:56 by gregory.p.smith, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg65456 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-04-14 02:56
In _PyUnicode_New() a unicode object is taken from the freelist but if the unicode_resize() call fails and returns -1, the goto onerror calls _Py_ForgetReference on the unicode object... But it has NULL _ob_prev and _ob_next values causing a crash when they're used. How to reproduce: * Make a 32-bit --with-pydebug build of Python trunk. * Run it on a machine with lots of ram (at least 3gigs recommended, or lots of swap and a heap of patience): ./python Python 2.6a2+ (trunk:62336M, Apr 13 2008, 18:51:30) >>> msg = 'A'*2000111222 >>> x = msg.decode('utf8') It segmentation faults in _Py_ForgetReference.
msg71442 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-19 16:16
This should has been fixed by Amaury as part of another patch (the one which is tested for in test_raiseMemError). Could you try again?
msg71475 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-08-19 20:12
Verified fixed. Python 2.6b2+ (trunk:65871, Aug 19 2008, 13:10:07) >>> msg = 'A'*2000111222 [12389 refs] >>> x = msg.decode('utf8') Traceback (most recent call last): File "", line 1, in File "/usr/local/google/home/gps/python/trunk/Lib/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) MemoryError [12431 refs]
History
Date User Action Args
2022-04-11 14:56:33 admin set github: 46881
2008-08-19 20:12:11 gregory.p.smith set status: open -> closedpriority: normalmessages: + resolution: fixedassignee: gregory.p.smith
2008-08-19 16:16:36 pitrou set nosy: + pitroumessages: +
2008-04-14 02:56:08 gregory.p.smith create