René's URL Explorer Experiment


Title: Double free corruption when allocation failures occur in assemble_init · Issue #151112 · python/cpython · GitHub

Open Graph Title: Double free corruption when allocation failures occur in assemble_init · Issue #151112 · python/cpython

X Title: Double free corruption when allocation failures occur in assemble_init · Issue #151112 · python/cpython

Description: Crash report What happened? import _testcapi compile("pass", "", "single") _testcapi.set_nomemory(64, 65) try: compile("pass", "", "single") except MemoryError: pass first = bytes(128) second = bytes(128) Job 1, './pytho...

Open Graph Description: Crash report What happened? import _testcapi compile("pass", "", "single") _testcapi.set_nomemory(64, 65) try: compile("pass", "", "single") except MemoryError: pass first = bytes(...

X Description: Crash report What happened? import _testcapi compile("pass", "<warmup>", "single") _testcapi.set_nomemory(64, 65) try: compile("pass", "<trigge...

Opengraph URL: https://github.com/python/cpython/issues/151112

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Double free corruption when allocation failures occur in assemble_init","articleBody":"# Crash report\n\n### What happened?\n\n```python\nimport _testcapi\n\ncompile(\"pass\", \"\u003cwarmup>\", \"single\")\n_testcapi.set_nomemory(64, 65)\ntry:\n    compile(\"pass\", \"\u003ctrigger>\", \"single\")\nexcept MemoryError:\n    pass\nfirst = bytes(128)\nsecond = bytes(128)\n```\n```\nJob 1, './python.exe reproduce_assemble…' terminated by signal SIGSEGV (Address boundary error)\n```\nNote, this reproducer only works if the allocation sizes are exactly the same as on my mac!  the nomemory values may need tweaking.\n\nThe chain is:\n - `_PyAssemble_MakeCodeObject` is called\n - this calls assemble_emit which calls `RETURN_IF_ERROR(assemble_init(a, first_lineno));` passing the assembler by ref as an argument.\n - An allocation failure happens in `assemble_init`, when allocating the linetable or the except table.\n - `assemble_init` cleans up by decreffing all members, BUT the assembler fields are left populated with the old pointers, and the caller has the assembler reference.\n - `assemble_emit` sees the error code and returns to `_PyAssemble_MakeCodeObject`\n - The result != SUCCESS, so makecode isn't called, but `assemble_free` IS called, causing a double free of at least `a->a_bytecode`.\n\nThe error manifests itself as heap corruption from the double free.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.16.0a0 (heads/main-dirty:f051c68923b, Jun  8 2026, 16:26:15) [Clang 21.0.0 (clang-2100.1.1.101)]\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-151142\n* gh-151153\n* gh-151205\n* gh-151206\n* gh-151207\n* gh-151234\n* gh-151313\n* gh-151314\n* gh-151315\n* gh-151350\n* gh-151351\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/stestagg","@type":"Person","name":"stestagg"},"datePublished":"2026-06-08T20:44:05Z","url":"https://github.com/python/cpython/issues/151112"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:137870b3-2058-6c55-c9ed-55346eaf281f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEAA2:317608:3B3FED6:4B071D5:6B01FACC
html-safe-noncebc9fbd1abf7a4777f233285a3b8287143b9983bd34e5a07b0d953d7c6b7e6f55
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUEyOjMxNzYwODozQjNGRUQ2OjRCMDcxRDU6NkIwMUZBQ0MiLCJ2aXNpdG9yX2lkIjoiNTAyNDMyNjkxNDQ0NjMyNjQ3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac651a96a1461be579ab80a58fe0ea3d5748e0b0a9a9aaa2117ab1adb87007ef96
hovercard-subject-tagissue:4616500841
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/151112/issue_layout
twitter:imagehttps://opengraph.githubassets.com/88b07c0ef0d3d2515e63ca19c8f1828c648beef7326fb9a7d64929cc061b9e4e/python/cpython/issues/151112
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/88b07c0ef0d3d2515e63ca19c8f1828c648beef7326fb9a7d64929cc061b9e4e/python/cpython/issues/151112
og:image:altCrash report What happened? import _testcapi compile("pass", "", "single") _testcapi.set_nomemory(64, 65) try: compile("pass", "", "single") except MemoryError: pass first = bytes(...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamestestagg
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/151112#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F151112
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F151112
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/151112
Reloadhttps://github.com/python/cpython/issues/151112
Reloadhttps://github.com/python/cpython/issues/151112
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/151112
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/151112
Double free corruption when allocation failures occur in assemble_inithttps://github.com/python/cpython/issues/151112#top
https://github.com/StanFromIreland
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
https://github.com/stestagg
stestagghttps://github.com/stestagg
on Jun 8, 2026https://github.com/python/cpython/issues/151112#issue-4616500841
gh-151112: Fix double free in assemble_init when out of memory #151142https://github.com/python/cpython/pull/151142
gh-151112: Move an assert that may fail in cfg_builder_check #151153https://github.com/python/cpython/pull/151153
[3.15] gh-151112: Fix double free in assemble_init when out of memory (GH-151142) #151205https://github.com/python/cpython/pull/151205
[3.14] gh-151112: Fix double free in assemble_init when out of memory (GH-151142) #151206https://github.com/python/cpython/pull/151206
[3.13] gh-151112: Fix double free in assemble_init when out of memory (GH-151142) #151207https://github.com/python/cpython/pull/151207
gh-151112: Fix crash in compiler_mod() when entering the current compilation unit fails #151234https://github.com/python/cpython/pull/151234
[3.15] gh-151112: Move an assert that may fail in cfg_builder_check (GH-151153) #151313https://github.com/python/cpython/pull/151313
[3.14] gh-151112: Move an assert that may fail in cfg_builder_check (GH-151153) #151314https://github.com/python/cpython/pull/151314
[3.13] gh-151112: Move an assert that may fail in cfg_builder_check (GH-151153) #151315https://github.com/python/cpython/pull/151315
[3.15] gh-151112: Fix crash in compiler_mod() when entering the current compilation unit fails (GH-151234) #151350https://github.com/python/cpython/pull/151350
[3.14] gh-151112: Fix crash in compiler_mod() when entering the current compilation unit fails (GH-151234) #151351https://github.com/python/cpython/pull/151351
stestagghttps://github.com/stestagg
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
on Jun 8, 2026https://github.com/python/cpython/issues/151112#event-26491399607
StanFromIrelandhttps://github.com/StanFromIreland
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
on Jun 8, 2026https://github.com/python/cpython/issues/151112#event-26492382059
https://github.com/stestagg
stestagghttps://github.com/stestagg
on Jun 8, 2026https://github.com/python/cpython/issues/151112#issuecomment-4653939305
StanFromIrelandhttps://github.com/StanFromIreland
on Jun 9, 2026https://github.com/python/cpython/issues/151112#event-26519278002
iritkatrielhttps://github.com/iritkatriel
on Jun 9, 2026https://github.com/python/cpython/issues/151112#event-26540498255
gh-151112: Fix double free in `assemble_init` when out of memory (#15…https://github.com/python/cpython/commit/580499177ca91477b53b4a40afcec7d3370265b0
gh-151112https://github.com/python/cpython/issues/151112
#15…https://github.com/python/cpython/pull/151142
5804991https://github.com/python/cpython/commit/580499177ca91477b53b4a40afcec7d3370265b0
[3.13] gh-151112: Fix double free in `assemble_init` when out of memo…https://github.com/python/cpython/commit/310125eb9d303046046d4f11a5fce5dede9c2fe8
gh-151112https://github.com/python/cpython/issues/151112
310125ehttps://github.com/python/cpython/commit/310125eb9d303046046d4f11a5fce5dede9c2fe8
[3.14] gh-151112: Fix double free in `assemble_init` when out of memo…https://github.com/python/cpython/commit/24cb16ee804791295b442eefc2dd30f4926efab9
gh-151112https://github.com/python/cpython/issues/151112
24cb16ehttps://github.com/python/cpython/commit/24cb16ee804791295b442eefc2dd30f4926efab9
[3.15] gh-151112: Fix double free in `assemble_init` when out of memo…https://github.com/python/cpython/commit/50765f43f72b62778ed896e34faef8b10fc07058
gh-151112https://github.com/python/cpython/issues/151112
50765f4https://github.com/python/cpython/commit/50765f43f72b62778ed896e34faef8b10fc07058
StanFromIrelandhttps://github.com/StanFromIreland
on Jun 11, 2026https://github.com/python/cpython/issues/151112#event-26617276566
gh-151112: Move an `assert` that may fail in `cfg_builder_check` (#15…https://github.com/python/cpython/commit/2d3381035df24fbf512d897daa19a1040f7af3fd
gh-151112https://github.com/python/cpython/issues/151112
#15…https://github.com/python/cpython/pull/151153
2d33810https://github.com/python/cpython/commit/2d3381035df24fbf512d897daa19a1040f7af3fd
[3.13] gh-151112: Move an `assert` that may fail in `cfg_builder_chec…https://github.com/python/cpython/commit/807333df7289bd303f6c8b02243ee9c31a02f3aa
gh-151112https://github.com/python/cpython/issues/151112
807333dhttps://github.com/python/cpython/commit/807333df7289bd303f6c8b02243ee9c31a02f3aa
[3.14] gh-151112: Move an `assert` that may fail in `cfg_builder_chec…https://github.com/python/cpython/commit/435af7f42b6eb4323b8cfc6b9e58c8205a633d64
gh-151112https://github.com/python/cpython/issues/151112
435af7fhttps://github.com/python/cpython/commit/435af7f42b6eb4323b8cfc6b9e58c8205a633d64
[3.15] gh-151112: Move an `assert` that may fail in `cfg_builder_chec…https://github.com/python/cpython/commit/e3b94d8fa459502e411ec1d0366d17bdb7523c1c
gh-151112https://github.com/python/cpython/issues/151112
e3b94d8https://github.com/python/cpython/commit/e3b94d8fa459502e411ec1d0366d17bdb7523c1c
gh-151112: Fix crash in `compiler_mod()` when entering the current co…https://github.com/python/cpython/commit/937d89c4d9b7c5fda6730a1127db118d881d13cb
gh-151112https://github.com/python/cpython/issues/151112
937d89chttps://github.com/python/cpython/commit/937d89c4d9b7c5fda6730a1127db118d881d13cb
https://github.com/StanFromIreland
StanFromIrelandhttps://github.com/StanFromIreland
on Jun 11, 2026https://github.com/python/cpython/issues/151112#issuecomment-4681872994
StanFromIrelandhttps://github.com/StanFromIreland
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 11, 2026https://github.com/python/cpython/issues/151112#event-26631933210
https://github.com/stestagg
stestagghttps://github.com/stestagg
on Jun 11, 2026https://github.com/python/cpython/issues/151112#issuecomment-4681909197
StanFromIrelandhttps://github.com/StanFromIreland
on Jun 11, 2026https://github.com/python/cpython/issues/151112#event-26632935747
[3.14] gh-151112: Fix crash in `compiler_mod()` when entering the cur…https://github.com/python/cpython/commit/5f8546e22f05baf67cd0c0fd29a2586b8acadf49
gh-151112https://github.com/python/cpython/issues/151112
5f8546ehttps://github.com/python/cpython/commit/5f8546e22f05baf67cd0c0fd29a2586b8acadf49
[3.15] gh-151112: Fix crash in `compiler_mod()` when entering the cur…https://github.com/python/cpython/commit/42e81e35a067320c71297d91846690210ab6858e
gh-151112https://github.com/python/cpython/issues/151112
42e81e3https://github.com/python/cpython/commit/42e81e35a067320c71297d91846690210ab6858e
philthompson10https://github.com/philthompson10
on Jun 17, 2026https://github.com/python/cpython/issues/151112#event-26873458821
pythongh-151112: Fix double free in `assemble_init` when out of memory (https://github.com/philthompson10/cpython/commit/dbd40b97c3efb913c9f26880d05bd4b350384640
pythongh-151112https://github.com/python/cpython/issues/151112
dbd40b9https://github.com/philthompson10/cpython/commit/dbd40b97c3efb913c9f26880d05bd4b350384640
pythongh-151112: Move an `assert` that may fail in `cfg_builder_check` (https://github.com/philthompson10/cpython/commit/8cb6dc6fe327154840ea446d6609bbe13a98e187
pythongh-151112https://github.com/python/cpython/issues/151112
8cb6dc6https://github.com/philthompson10/cpython/commit/8cb6dc6fe327154840ea446d6609bbe13a98e187
pythongh-151112: Fix crash in `compiler_mod()` when entering the curr…https://github.com/philthompson10/cpython/commit/3ed2f61ad2b0c0c637643e0812035ae1cee1d777
pythongh-151112https://github.com/python/cpython/issues/151112
3ed2f61https://github.com/philthompson10/cpython/commit/3ed2f61ad2b0c0c637643e0812035ae1cee1d777
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/151112
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/151112
StanFromIrelandhttps://github.com/StanFromIreland
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.