This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: possible overflow when organize struct.pack_into error message
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: andrewnester, louielu, serhiy.storchaka, xiang.zhang
Priority: normal Keywords:

Created on 2017-05-03 07:20 by xiang.zhang, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1682 merged Yuan Liu, 2017-05-20 15:25
Messages (2)
msg292852 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-03 07:20
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.
msg294985 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-06-02 06:33
New changeset aead53b6ee27915de248b07de509529174aaad21 by Xiang Zhang (Johan Liu) in branch 'master':
bpo-30245: Fix possible overflow when organize struct.pack_into error message (#1682)
Date User Action Args
2022-04-11 14:58:46adminsetgithub: 74431
2017-06-02 06:35:24xiang.zhangsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-06-02 06:33:07xiang.zhangsetmessages: + msg294985
2017-05-20 15:42:55serhiy.storchakasetcomponents: + Extension Modules
stage: needs patch -> patch review
2017-05-20 15:25:35Yuan Liusetpull_requests: + pull_request1777
2017-05-03 07:20:40xiang.zhangcreate