GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Undefined behavior in `struct.unpack` · Issue #96735 · python/cpython

Undefined behavior in struct.unpack #96735

New issue
Copy link
New issue
Copy link
Closed
Closed
Undefined behavior in struct.unpack#96735
Copy link
Assignees
mdickinson
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

Description

@kumaraditya303
kumaraditya303
opened on Sep 10, 2022
Issue body actions

Reproducer:

import struct
struct.unpack('!q', b'\xff\xff\xff\xff\xff\xff\xff\xff')

Error:

Modules/_struct.c:842:15: runtime error: left shift of 72057594037927935 by 8 places cannot be represented in type 'long long int'

Compiler options:

./configure -C --with-pydebug --with-address-sanitizer --with-undefined-behavior-sanitizer 

Python version: Python 3.12.0a0 (heads/main:30cc1901efa, Sep 10 2022, 10:14:58) [GCC 9.4.0] on linux

Reacted by Matthias Görgens

Activity

  1. kumaraditya303
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    3.11only security fixesonly security fixes
    3.10 (EOL)end of lifeend of life
    type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
    3.12only security fixesonly security fixes
    on Sep 10, 2022
  2. kumaraditya303 commented on Sep 10, 2022

    @kumaraditya303
    kumaraditya303
    on Sep 10, 2022
    ContributorAuthor
    More actions

    cc @mdickinson

  3. mdickinson commented on Sep 10, 2022

    @mdickinson
    mdickinson
    on Sep 10, 2022
    Member
    More actions

    @kumaraditya303 Thanks; this should be an easy fix.

  4. mdickinson
    self-assigned this
    on Sep 10, 2022
  5. mdickinson
    added a commit that references this issue on Sep 25, 2022

    gh-96735: Fix undefined behaviour in struct unpacking functions (#96739)

    f5f047a
  6. mdickinson commented on Sep 25, 2022

    @mdickinson
    mdickinson
    on Sep 25, 2022
    Member
    More actions

    Fixed for 3.12 in #96739. I agree with @matthiasgoergens that it's not worth fixing in 3.10 and 3.11, because the issue doesn't manifest itself in release builds, where -fwrapv is used.

  7. mdickinson
    closed this as completedon Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @mdickinson
    mdickinson

Labels

3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.