René's URL Explorer Experiment


Title: _pickle.Unpickler crashes after assigning an empty memo dictionary · Issue #162334 · python/cpython · GitHub

Open Graph Title: _pickle.Unpickler crashes after assigning an empty memo dictionary · Issue #162334 · python/cpython

X Title: _pickle.Unpickler crashes after assigning an empty memo dictionary · Issue #162334 · python/cpython

Description: Bug description Assigning an empty dictionary to the C-accelerated _pickle.Unpickler.memo causes a subsequent protocol-4 MEMOIZE opcode to crash the interpreter instead of completing safely or raising a Python exception. This is a determ...

Open Graph Description: Bug description Assigning an empty dictionary to the C-accelerated _pickle.Unpickler.memo causes a subsequent protocol-4 MEMOIZE opcode to crash the interpreter instead of completing safely or rais...

X Description: Bug description Assigning an empty dictionary to the C-accelerated _pickle.Unpickler.memo causes a subsequent protocol-4 MEMOIZE opcode to crash the interpreter instead of completing safely or rais...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"_pickle.Unpickler crashes after assigning an empty memo dictionary","articleBody":"### Bug description\n\nAssigning an empty dictionary to the C-accelerated `_pickle.Unpickler.memo` causes a subsequent protocol-4 `MEMOIZE` opcode to crash the interpreter instead of completing safely or raising a Python exception.\n\nThis is a **deterministic, single-threaded** reproduction. An AddressSanitizer-enabled non-debug CPython build reports a heap-buffer-overflow (8-byte out-of-bounds read) in `_Unpickler_MemoPut()`.\n\nThis report is being opened as a **regular bug report at the request of the CPython security triage team**. It does not claim that deserializing untrusted pickle data is safe, nor does it claim remote exploitability.\n\n### Minimal reproducer\n\n```python\nimport io\nimport _pickle\n\nu = _pickle.Unpickler(io.BytesIO(b\"\\x80\\x04N\\x94.\"))\nu.memo = {}\nu.load()\n```\n\nThe stream contains `PROTO 4`, `NONE`, `MEMOIZE`, and `STOP`.\n\n### Actual behavior\n\n- **CPython 3.16.0a2+dev** (commit `b09a7e92fb0ab958a52ad94e376402cdd3da09b2`), Clang 23.1.1, non-debug, `--without-pymalloc`, `-O1 -g -fno-omit-frame-pointer -fsanitize=address,undefined`: AddressSanitizer reports `heap-buffer-overflow`, `READ of size 8`, at `Modules/_pickle.c:1742` (`_Unpickler_MemoPut`), immediately after a zero-sized allocation represented as a 1-byte region.\n- **CPython 3.16 debug build**: assertion failure in `_Unpickler_ResizeMemoList()` (`Modules/_pickle.c:1661`), SIGABRT.\n- **CPython 3.14.7 release build**: SIGSEGV.\n\nRelevant symbolized frames on the tested 3.16 build:\n\n```text\n_Unpickler_MemoPut      Modules/_pickle.c:1742\n_Unpickler_MemoPut      Modules/_pickle.c:1664 (resize path)\nload                    Modules/_pickle.c:6975\n_pickle_Unpickler_load  Modules/_pickle.c:7592\n```\n\n### Expected behavior\n\nAssigning an empty memo dictionary should not cause an out-of-bounds native memory access. Subsequent `load()` should either work or raise a controlled Python exception.\n\n### Suspected root cause\n\nAfter `u.memo = {}`, the internal memo has zero capacity (`memo_size == 0`). The first `MEMOIZE` insertion uses index zero. The resize request calculated from `idx * 2` is therefore zero, leaving no element available at index zero. The subsequent `old_item = self->memo[idx]` reads outside the allocated memo array.\n\nA possible fix is to ensure memo capacity is **strictly greater than the insertion index**, including when `idx == 0`, with appropriate overflow checks. This suggestion has not yet been validated as a patch.\n\n### Related issue\n\n- #111066 describes incorrect behavior when assigning a dictionary to `Unpickler.memo`. This report adds a **deterministic native crash and sanitizer-confirmed out-of-bounds read** after assigning an *empty* dictionary.\n- This does **not** require concurrent access and is distinct from free-threading races.\n\n### CPython versions tested on\n\n3.14.7; 3.16.0a2+dev\n\n### Operating systems tested on\n\nLinux x86-64\n\n### Reporter\n\nHamdy Abou El Anein\n\nI can provide the full ASan log, symbolized trace, and test a regression fix if useful.","author":{"url":"https://github.com/hamdyaea","@type":"Person","name":"hamdyaea"},"datePublished":"2026-11-20T18:41:06Z","url":"https://github.com/python/cpython/issues/162334"}

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:656633e7-f40c-cffa-5c8a-412b429468e6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA63A:1DC4CC:1177E12:1746A7D:6B01E93D
html-safe-nonce9dd5e04fc465639e5433bc7fc7027481a0b6261ece8b05792102d40bcf504737
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjNBOjFEQzRDQzoxMTc3RTEyOjE3NDZBN0Q6NkIwMUU5M0QiLCJ2aXNpdG9yX2lkIjoiNjk2ODI0MDk2MjQzMDY5MTY0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac55f6648ed30c2e971ca3fba7938de2e7896e981846a9d20c6bbef283b571c1dd
hovercard-subject-tagissue:6517539011
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/162334/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2e776e9336e1a7f2d4680c2cae73e539b0b82d9e3c716d1428edc563e08dd62b/python/cpython/issues/162334
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2e776e9336e1a7f2d4680c2cae73e539b0b82d9e3c716d1428edc563e08dd62b/python/cpython/issues/162334
og:image:altBug description Assigning an empty dictionary to the C-accelerated _pickle.Unpickler.memo causes a subsequent protocol-4 MEMOIZE opcode to crash the interpreter instead of completing safely or rais...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamehamdyaea
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/162334#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F162334
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%2F162334
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/162334
Reloadhttps://github.com/python/cpython/issues/162334
Reloadhttps://github.com/python/cpython/issues/162334
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/162334
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/162334
_pickle.Unpickler crashes after assigning an empty memo dictionaryhttps://github.com/python/cpython/issues/162334#top
https://github.com/hamdyaea
hamdyaeahttps://github.com/hamdyaea
on Nov 20, 2026https://github.com/python/cpython/issues/162334#issue-6517539011
Assigning a dict to the memo of an Unpickler object fails #111066https://github.com/python/cpython/issues/111066
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/162334
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/162334
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.