This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients jnferguson, lemburg
Date 2008-04-11.23:29:28
SpamBayes Score 0.0086744735
Marked as misclassified No
Message-id <1207956570.0.0.734398122695.issue2620@psf.upfronthosting.co.za>
In-reply-to
Content
You are probably referring to 32-bit platforms. At least on 64-bit
platforms, there's no problem with your test cases:

>>> # this is to get the unicode_freelist initialized
... # the length of the string must be <= 9 to keep
... # unicode->str from being deallocated and set to
... # NULL
... bla = unicode('IOActive')
>>> del bla
>>>
>>>
>>> msg = 'A'*2147483647
>>>
>>> msg.decode('utf7')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError

The code does check for success of the realloc():

    PyMem_RESIZE(unicode->str, Py_UNICODE, length + 1);
    if (!unicode->str) {
	unicode->str = (Py_UNICODE *)oldstr;
        PyErr_NoMemory();
        return -1;
    }

Are you after the integer overflow and the fact that realloc() would (if
possible) allocate a buffer smaller than needed ?
History
Date User Action Args
2008-04-11 23:29:30lemburgsetspambayes_score: 0.00867447 -> 0.0086744735
recipients: + lemburg, jnferguson
2008-04-11 23:29:30lemburgsetspambayes_score: 0.00867447 -> 0.00867447
messageid: <1207956570.0.0.734398122695.issue2620@psf.upfronthosting.co.za>
2008-04-11 23:29:29lemburglinkissue2620 messages
2008-04-11 23:29:28lemburgcreate