René's URL Explorer Experiment


Title: gh-143378: Fix UAF when `BytesIO` is concurrently mutated during `write` operations by superboy-zjc · Pull Request #143408 · python/cpython · GitHub

Open Graph Title: gh-143378: Fix UAF when `BytesIO` is concurrently mutated during `write` operations by superboy-zjc · Pull Request #143408 · python/cpython

X Title: gh-143378: Fix UAF when `BytesIO` is concurrently mutated during `write` operations by superboy-zjc · Pull Request #143408 · python/cpython

Description: PyObject_GetBuffer() can execute user code (e.g. via buffer), which may close or otherwise mutate a BytesIO object while write() or writelines() is in progress. This could invalidate the internal buffer and lead to a use-after-free. Temporarily bump the exports counter while acquiring the input buffer to block re-entrant mutation, and add regression tests to ensure such cases raise BufferError instead of crashing. Issue: gh-143378

Open Graph Description: PyObject_GetBuffer() can execute user code (e.g. via buffer), which may close or otherwise mutate a BytesIO object while write() or writelines() is in progress. This could invalidate the internal b...

X Description: PyObject_GetBuffer() can execute user code (e.g. via buffer), which may close or otherwise mutate a BytesIO object while write() or writelines() is in progress. This could invalidate the internal b...

Opengraph URL: https://github.com/python/cpython/pull/143408

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:7ee54884-d097-dba4-e31c-02fc76300d51
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id99A6:3E22DA:114797F:17CEE8C:696A8DF8
html-safe-noncebac202232353796d358f7698339907d06edbb4e5732d0c055115d23b245cdbc4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OUE2OjNFMjJEQToxMTQ3OTdGOjE3Q0VFOEM6Njk2QThERjgiLCJ2aXNpdG9yX2lkIjoiNzU0OTg3NDUxMzE4OTE3ODg3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac785a0abce599e9e0b746f57d8e5b171aa425c5c376c749d870c68e8ff38bfff9
hovercard-subject-tagpull_request:3144058978
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/143408/files
twitter:imagehttps://avatars.githubusercontent.com/u/60600792?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/60600792?s=400&v=4
og:image:altPyObject_GetBuffer() can execute user code (e.g. via buffer), which may close or otherwise mutate a BytesIO object while write() or writelines() is in progress. This could invalidate the internal b...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noned2aa6dedd7d97fa651b17c40401f2605f309df5ca5fb659bf0554cf34f1de825
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec1dbca8981c5e3d6a69bce2f1d289e732b86241d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/143408/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F143408%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F143408%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/143408/files
Reloadhttps://github.com/python/cpython/pull/143408/files
Reloadhttps://github.com/python/cpython/pull/143408/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/143408/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/143408/files
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
serhiy-storchakahttps://github.com/serhiy-storchaka
python:mainhttps://github.com/python/cpython/tree/main
superboy-zjc:issue-143378https://github.com/superboy-zjc/cpython/tree/issue-143378
Conversation 38 https://github.com/python/cpython/pull/143408
Commits 13 https://github.com/python/cpython/pull/143408/commits
Checks 52 https://github.com/python/cpython/pull/143408/checks
Files changed 4 https://github.com/python/cpython/pull/143408/files
gh-143378: Fix UAF when BytesIO is concurrently mutated during write operations https://github.com/python/cpython/pull/143408/files#top
Show all changes 13 commits https://github.com/python/cpython/pull/143408/files
2409319 gh-143378: Fix use-after-free BytesIO write via re-entrant buffer access superboy-zjc Jan 4, 2026 https://github.com/python/cpython/pull/143408/commits/240931999cd24ef56e087b77d127c697e4d81120
2c3035c gh-143378: Fix Sphinx references in NEWS entry superboy-zjc Jan 4, 2026 https://github.com/python/cpython/pull/143408/commits/2c3035cd564ba0e95e6aa91fe22f99278a9ff0e1
1a667a4 Update Lib/test/test_io/test_memoryio.py superboy-zjc Jan 4, 2026 https://github.com/python/cpython/pull/143408/commits/1a667a42dc911b10d0c5dfa30b28511338d85107
35f9856 Update Modules/_io/bytesio.c superboy-zjc Jan 4, 2026 https://github.com/python/cpython/pull/143408/commits/35f98563265618ab5dfe3ce9e0e99374bb6ac22f
5997e90 Update Lib/test/test_io/test_memoryio.py superboy-zjc Jan 4, 2026 https://github.com/python/cpython/pull/143408/commits/5997e9007a3eef30c772d2dcf13a09a4073d6249
27c99da gh-143378: reduce duplication in unit tests per review superboy-zjc Jan 4, 2026 https://github.com/python/cpython/pull/143408/commits/27c99dabc535b0585e7946401ba5c09314b1c642
586fbdc gh-143378: address review comments in NEWS entry superboy-zjc Jan 4, 2026 https://github.com/python/cpython/pull/143408/commits/586fbdc1c773d78a23f4897e3cec7d90ce11ed50
89b2cb7 gh-143378: clean up unit tests superboy-zjc Jan 4, 2026 https://github.com/python/cpython/pull/143408/commits/89b2cb76c700e1ceb2871e450456aa995a82a339
7805fa1 gh-143378: refactor the buffer check and unit tests for C and Python … superboy-zjc Jan 5, 2026 https://github.com/python/cpython/pull/143408/commits/7805fa1411f27a1d7915130bcf83eb1fb3b35b62
6ac90be gh-143378: clean up test comments superboy-zjc Jan 6, 2026 https://github.com/python/cpython/pull/143408/commits/6ac90be01f9ce9e8bcac4485f686ef71c32770a6
9956cef Merge branch 'main' into issue-143378 superboy-zjc Jan 6, 2026 https://github.com/python/cpython/pull/143408/commits/9956cef2ac6297a03b6bbdbe016bb5166bb6142a
2155e48 gh-143378: clean up duplicated shape check superboy-zjc Jan 6, 2026 https://github.com/python/cpython/pull/143408/commits/2155e48e2eb346be72b1b94960f7be3a6530c8fa
4f0b8b6 gh-143378: clean up duplicated shape check in Python implementation superboy-zjc Jan 8, 2026 https://github.com/python/cpython/pull/143408/commits/4f0b8b619001e7248f0f391195474a1eb7a1b797
Clear filters https://github.com/python/cpython/pull/143408/files
Please reload this pagehttps://github.com/python/cpython/pull/143408/files
Please reload this pagehttps://github.com/python/cpython/pull/143408/files
_pyio.py https://github.com/python/cpython/pull/143408/files#diff-bcdfa9cbb0764d7959cda48f9084d79785f87c5ad7460f27ba2678b0bda76e38
test_memoryio.py https://github.com/python/cpython/pull/143408/files#diff-437d27266beabfc02bcd01a41b6d3f9f82c4242087c0be99caad811a6b296776
2026-01-03-19-41-36.gh-issue-143378.29AvE7.rst https://github.com/python/cpython/pull/143408/files#diff-f81e02293f5884280028847f4ae18c390e8d2c39effeba1d70cc8396bcff2ff5
bytesio.c https://github.com/python/cpython/pull/143408/files#diff-fbdbc4e9c4c46bb4d0afb3927ea0ba919e62c1a79c390aa695a50fc317e48e09
Lib/_pyio.pyhttps://github.com/python/cpython/pull/143408/files#diff-bcdfa9cbb0764d7959cda48f9084d79785f87c5ad7460f27ba2678b0bda76e38
View file https://github.com/superboy-zjc/cpython/blob/4f0b8b619001e7248f0f391195474a1eb7a1b797/Lib/_pyio.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/143408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/143408/files#diff-bcdfa9cbb0764d7959cda48f9084d79785f87c5ad7460f27ba2678b0bda76e38
Please reload this pagehttps://github.com/python/cpython/pull/143408/files
https://github.com/python/cpython/pull/143408/files#diff-bcdfa9cbb0764d7959cda48f9084d79785f87c5ad7460f27ba2678b0bda76e38
Lib/test/test_io/test_memoryio.pyhttps://github.com/python/cpython/pull/143408/files#diff-437d27266beabfc02bcd01a41b6d3f9f82c4242087c0be99caad811a6b296776
View file https://github.com/superboy-zjc/cpython/blob/4f0b8b619001e7248f0f391195474a1eb7a1b797/Lib/test/test_io/test_memoryio.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/143408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/143408/files#diff-437d27266beabfc02bcd01a41b6d3f9f82c4242087c0be99caad811a6b296776
Please reload this pagehttps://github.com/python/cpython/pull/143408/files
https://github.com/python/cpython/pull/143408/files#diff-437d27266beabfc02bcd01a41b6d3f9f82c4242087c0be99caad811a6b296776
Misc/NEWS.d/next/Library/2026-01-03-19-41-36.gh-issue-143378.29AvE7.rsthttps://github.com/python/cpython/pull/143408/files#diff-f81e02293f5884280028847f4ae18c390e8d2c39effeba1d70cc8396bcff2ff5
View file https://github.com/superboy-zjc/cpython/blob/4f0b8b619001e7248f0f391195474a1eb7a1b797/Misc/NEWS.d/next/Library/2026-01-03-19-41-36.gh-issue-143378.29AvE7.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/143408/{{ revealButtonHref }}
Modules/_io/bytesio.chttps://github.com/python/cpython/pull/143408/files#diff-fbdbc4e9c4c46bb4d0afb3927ea0ba919e62c1a79c390aa695a50fc317e48e09
View file https://github.com/superboy-zjc/cpython/blob/4f0b8b619001e7248f0f391195474a1eb7a1b797/Modules/_io/bytesio.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/143408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/143408/files#diff-fbdbc4e9c4c46bb4d0afb3927ea0ba919e62c1a79c390aa695a50fc317e48e09
Please reload this pagehttps://github.com/python/cpython/pull/143408/files
https://github.com/python/cpython/pull/143408/files#diff-fbdbc4e9c4c46bb4d0afb3927ea0ba919e62c1a79c390aa695a50fc317e48e09
Please reload this pagehttps://github.com/python/cpython/pull/143408/files
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.