[issue30245] possible overflow when organize struct.pack_into error message

Xiang Zhang report at bugs.python.org
Wed May 3 03:20:40 EDT 2017


New submission from Xiang Zhang:

In #29649, struct.pack_into's error message was improved. But the message could be confusing encountering a large offset due to overflow:

>>> struct.pack_into('I', bytearray(10), sys.maxsize, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
struct.error: pack_into requires a buffer of at least -9223372036854775805 bytes for packing 4 bytes at offset 9223372036854775807 (actual buffer size is 10)

BTW, really long the error message.

----------
messages: 292852
nosy: andrewnester, louielu, serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
stage: needs patch
status: open
title: possible overflow when organize struct.pack_into error message
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30245>
_______________________________________


More information about the Python-bugs-list mailing list