Title: Pointer arithmetic on NULL in INSTRUMENTED_JUMP · Issue #152375 · python/cpython · GitHub
Open Graph Title: Pointer arithmetic on NULL in INSTRUMENTED_JUMP · Issue #152375 · python/cpython
X Title: Pointer arithmetic on NULL in INSTRUMENTED_JUMP · Issue #152375 · python/cpython
Description: Bug report Bug description: Found by the CI UBSan job, e.g. this run: Python/generated_cases.c.h:8158:17: runtime error: applying non-zero offset 44 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Python/generated...
Open Graph Description: Bug report Bug description: Found by the CI UBSan job, e.g. this run: Python/generated_cases.c.h:8158:17: runtime error: applying non-zero offset 44 to null pointer SUMMARY: UndefinedBehaviorSaniti...
X Description: Bug report Bug description: Found by the CI UBSan job, e.g. this run: Python/generated_cases.c.h:8158:17: runtime error: applying non-zero offset 44 to null pointer SUMMARY: UndefinedBehaviorSaniti...
Opengraph URL: https://github.com/python/cpython/issues/152375
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pointer arithmetic on NULL in INSTRUMENTED_JUMP","articleBody":"# Bug report\n\n### Bug description:\n\nFound by the CI UBSan job, e.g. [this run](https://github.com/python/cpython/actions/runs/28271616914/job/83769993905?pr=152311):\n\n```\nPython/generated_cases.c.h:8158:17: runtime error: applying non-zero offset 44 to null pointer\nSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Python/generated_cases.c.h:8158:17 \n```\n\nNote this requires applying https://github.com/python/cpython/pull/152311 which seems to change the state ever so slightly uncovering the UB. Locally I get with clang:\n\n```\n$ ./python -m test test_monitoring\nUsing random seed: 1062411673\n0:00:00 load avg: 1.00 mem: 41.2 MiB Run 1 test sequentially in a single process\n0:00:00 load avg: 1.00 mem: 41.2 MiB [1/1] test_monitoring\nPython/generated_cases.c.h:8158:17: runtime error: applying non-zero offset 44 to null pointer\nSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Python/generated_cases.c.h:8158:17 \nPython/generated_cases.c.h:8050:13: runtime error: applying non-zero offset 2 to null pointer\nSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Python/generated_cases.c.h:8050:13 \nPython/generated_cases.c.h:13861:59: runtime error: applying non-zero offset to non-null pointer 0x000000000002 produced null pointer\nSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Python/generated_cases.c.h:13861:59 \nPython/generated_cases.c.h:13881:57: runtime error: applying non-zero offset to non-null pointer 0x000000000002 produced null pointer\nSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Python/generated_cases.c.h:13881:57 \n0:00:00 load avg: 1.00 mem: 43.0 MiB [1/1] test_monitoring passed\n\n== Tests result: SUCCESS ==\n\n1 test OK.\n\nTotal duration: 357 ms\nTotal tests: run=98\nTotal test files: run=1/1\nResult: SUCCESS\n```\n\nThe UB is reported, e.g. at:\n\nhttps://github.com/python/cpython/blob/b3154aa4507f6d2612c128e912860be963dbff1a/Python/generated_cases.c.h#L8158\n\nWhich calls `INSTRUMENTED_JUMP`:\n\nhttps://github.com/python/cpython/blob/b3154aa4507f6d2612c128e912860be963dbff1a/Python/ceval_macros.h#L387-L403\n\nIf `_Py_call_instrumentation_jump` raises it returns NULL (setting *next_instr*). But then on the error path, we do `next_instr + oparg` resulting in the UB.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-152376\n* gh-152566\n* gh-152567\n* gh-152577\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/StanFromIreland","@type":"Person","name":"StanFromIreland"},"datePublished":"2026-06-27T08:58:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/152375/cpython/issues/152375"}
| 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:b372c32e-0095-53b4-5b9a-959e180ced03 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC8C:170C03:C2DB23:105C3DD:6A516767 |
| html-safe-nonce | e2979fb74a45d4aa16b04132950ea75434f55a11eda704f397b1bc5f83d16f95 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzhDOjE3MEMwMzpDMkRCMjM6MTA1QzNERDo2QTUxNjc2NyIsInZpc2l0b3JfaWQiOiI2MjczNTI5MDAxNTYzNzQ0MTAzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 03a1e7a125fcf790a38d878f1963bc4b147784ba0d7aa0ac828ddbecd594f23f |
| hovercard-subject-tag | issue:4757624285 |
| 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/152375/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c677272ddb5b4581148028b783415143cd341463a631cf6d61e7f1462225e904/python/cpython/issues/152375 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c677272ddb5b4581148028b783415143cd341463a631cf6d61e7f1462225e904/python/cpython/issues/152375 |
| og:image:alt | Bug report Bug description: Found by the CI UBSan job, e.g. this run: Python/generated_cases.c.h:8158:17: runtime error: applying non-zero offset 44 to null pointer SUMMARY: UndefinedBehaviorSaniti... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | StanFromIreland |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 60eaaf6d4dbaa817031b556aebd8a0a7eeb81b97 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width