
report at bugs
Nov 6, 2009, 8:16 AM
Post #1 of 2
(58 views)
Permalink
|
|
[issue7273] struct.pack adding extra '\x00' character in very specific case
|
|
New submission from Caleb Madrigal <caleb.madrigal[at]gmail.com>: struct.pack("17scBH", 'a'*17, 'c', 255, 65535) produces 'aaaaaaaaaaaaaaaaac\xff\x00\xff\xff'. Notice the extra '\x00' character between '\xff' and '\xff\xff'. I have noticed that this happens when there is an odd-length string (like '17s'), followed by a character ('c'), followed by a byte ('B'), followed by an unsigned short ('H'). Other variations reproduce it also (such as using a 19-character string). However, if any one of the following modifications are made to the format, the problem goes away: * Change the string to 16s * Remove the byte ('B') * Remove the character ('c') * Remove the unsigned short ('H') So obviously, this is a seriously deep, dark corner-case. ---------- components: Library (Lib) messages: 94980 nosy: cmadrigal severity: normal status: open title: struct.pack adding extra '\x00' character in very specific case type: behavior versions: Python 2.5, Python 2.6, Python 3.0 _______________________________________ Python tracker <report[at]bugs.python.org> <http://bugs.python.org/issue7273> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
|