[Python-Dev] RE: [Zope-Coders] core dump in Zope 2.7 test suite

Tim Peters tim.one at comcast.net
Tue Sep 16 16:46:31 EDT 2003


[Martin v. Löwis]
> ...
> I agree with Tim that, in no case, resize should be called for a
> garbage string - only valid strings (i.e. with truly allocated memory)
> should ever be resized.

unicode->str pointed to properly allocated memory in the failing cases, but
to uninitialized allocated memory.  So str[0] was just some random
collection of bits from the heap, and checking

    random bits < 256

wasn't enough to weed out the cases where the random bits happened to look
like a negative integer.  For Jeremy, str[0] was 0xcbcbcbcb (for me it was
0xcbcb), and using that as an index blew up.

...

[Tim]
>> Or is there an implicit assumption that Py_UNICODE is always an
>> unsigned type (in which case, why isn't the literal 256U?

[Martin]
> Likely, the author of the code was subconsciously assuming
> so. However, that assumption is invalid, and sharing should only
> happen for ordinals in range(256).

I've since patched Jeremy's patch to try to live with that Py_UNICODE may be
a signed type too.




More information about the Zope-Coders mailing list