[Python-Dev] unicode vs buffer (array) design issue can crash interpreter (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Thu Mar 30 19:08:37 CEST 2006


Neal Norwitz wrote:

See http://python.org/sf/1454485 for the gory details. Basically if you create a unicode array (array.array('u')) and try to append an 8-bit string (ie, not unicode), you can crash the interpreter.

The problem is that the string is converted without question to a unicode buffer. Within unicode, it assumes the data to be valid, but this isn't necessarily the case. We wind up accessing an array with a negative index and boom.

There are several problems combined here, which might need discussion:

Regards, Martin



More information about the Python-Dev mailing list