Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible overflow when organize struct.pack_into error message #74431

Closed
zhangyangyu opened this issue May 3, 2017 · 2 comments
Closed

possible overflow when organize struct.pack_into error message #74431

zhangyangyu opened this issue May 3, 2017 · 2 comments
Labels
3.7 (EOL) end of life extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@zhangyangyu
Copy link
Member

BPO 30245
Nosy @serhiy-storchaka, @zhangyangyu, @andrewnester, @mlouielu
PRs
  • bpo-30245: possible overflow when organize struct.pack_into error message #1682
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-06-02.06:35:24.285>
    created_at = <Date 2017-05-03.07:20:40.193>
    labels = ['extension-modules', 'type-bug', '3.7']
    title = 'possible overflow when organize struct.pack_into error message'
    updated_at = <Date 2017-06-02.06:35:24.285>
    user = 'https://github.com/zhangyangyu'

    bugs.python.org fields:

    activity = <Date 2017-06-02.06:35:24.285>
    actor = 'xiang.zhang'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-06-02.06:35:24.285>
    closer = 'xiang.zhang'
    components = ['Extension Modules']
    creation = <Date 2017-05-03.07:20:40.193>
    creator = 'xiang.zhang'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30245
    keywords = []
    message_count = 2.0
    messages = ['292852', '294985']
    nosy_count = 4.0
    nosy_names = ['serhiy.storchaka', 'xiang.zhang', 'andrewnester', 'louielu']
    pr_nums = ['1682']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30245'
    versions = ['Python 3.7']

    @zhangyangyu
    Copy link
    Member Author

    In bpo-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.

    @zhangyangyu zhangyangyu added 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error labels May 3, 2017
    @serhiy-storchaka serhiy-storchaka added the extension-modules C modules in the Modules dir label May 20, 2017
    @zhangyangyu
    Copy link
    Member Author

    New changeset aead53b by Xiang Zhang (Johan Liu) in branch 'master':
    bpo-30245: Fix possible overflow when organize struct.pack_into error message (bpo-1682)
    aead53b

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants