Title: Undefined behavior in `struct.unpack` · Issue #96735 · python/cpython · GitHub
Open Graph Title: Undefined behavior in `struct.unpack` · Issue #96735 · python/cpython
X Title: Undefined behavior in `struct.unpack` · Issue #96735 · python/cpython
Description: 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...
Open Graph Description: 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 ...
X Description: 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...
Opengraph URL: https://github.com/python/cpython/issues/96735
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Undefined behavior in `struct.unpack`","articleBody":"Reproducer:\r\n\r\n```py\r\nimport struct\r\nstruct.unpack('!q', b'\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff')\r\n```\r\nError:\r\n```console\r\nModules/_struct.c:842:15: runtime error: left shift of 72057594037927935 by 8 places cannot be represented in type 'long long int'\r\n```\r\n\r\nCompiler options:\r\n\r\n```\r\n./configure -C --with-pydebug --with-address-sanitizer --with-undefined-behavior-sanitizer \r\n```\r\n\r\nPython version: `Python 3.12.0a0 (heads/main:30cc1901efa, Sep 10 2022, 10:14:58) [GCC 9.4.0] on linux`","author":{"url":"https://github.com/kumaraditya303","@type":"Person","name":"kumaraditya303"},"datePublished":"2022-09-10T10:24:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/96735/cpython/issues/96735"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6264e459-b2ec-1835-41f2-556e01adfa28 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E586:2E7615:3E7FBD:519032:696B3FB4 |
| html-safe-nonce | 18f68c61e4310ff8985daa8a9fb2b56e6d74663f7f4cc93d3a7ab0f48b45126d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTg2OjJFNzYxNTozRTdGQkQ6NTE5MDMyOjY5NkIzRkI0IiwidmlzaXRvcl9pZCI6IjM5MTU2NjY2NjI3MDU4MDcyODQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ef2bc4b0d8923791f6c20dcb3194a03d543b06e5d1ffd67ec34e0d3b97cf3075 |
| hovercard-subject-tag | issue:1368578739 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/96735/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a15fa6e85b5219108ab9cbecc345186f585b64dab745cd3c530d4f9cc25e9bd9/python/cpython/issues/96735 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a15fa6e85b5219108ab9cbecc345186f585b64dab745cd3c530d4f9cc25e9bd9/python/cpython/issues/96735 |
| og:image:alt | 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 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kumaraditya303 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width