New submission from Jon Heiner:

I believe there is an issue with the _struct.c handling of Pascal style strings.

In the _struct.c:s_unpack_internal() function (reading 2.7.6 and 2.7.9 source 
from tgz ball), the size parameter 'n' is clamped to code->size-1.

As far as I can tell, 'n' is set to the correct deserialized value, but the 
code->size value is not set to 255. I could be incorrect, as I'm not running in 
a debugger.

I've attached a short repro case. Note the use of unpack_from() as otherwise 
unpac() will thrown an error. Additionally, I may be using it wrong, but this 
feels correct.

----------
components: Library (Lib)
files: unpack_pascal.py
messages: 239644
nosy: jonheiner, mark.dickinson, meador.inge
priority: normal
severity: normal
status: open
title: struct.unpack returns null pascal strings - [first] bug report
versions: Python 2.7
Added file: http://bugs.python.org/file38745/unpack_pascal.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23816>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to