René's URL Explorer Experiment


Title: _remote_debugging: unbounded allocation when a profiling binary file declares oversized table counts · Issue #152718 · python/cpython · GitHub

Open Graph Title: _remote_debugging: unbounded allocation when a profiling binary file declares oversized table counts · Issue #152718 · python/cpython

X Title: _remote_debugging: unbounded allocation when a profiling binary file declares oversized table counts · Issue #152718 · python/cpython

Description: Bug report Bug description The binary profile reader in _remote_debugging (used by python -m profiling.sampling to replay .pyb files) reads the string-table and frame-table entry counts from the file footer and allocates arrays of that s...

Open Graph Description: Bug report Bug description The binary profile reader in _remote_debugging (used by python -m profiling.sampling to replay .pyb files) reads the string-table and frame-table entry counts from the fi...

X Description: Bug report Bug description The binary profile reader in _remote_debugging (used by python -m profiling.sampling to replay .pyb files) reads the string-table and frame-table entry counts from the fi...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"_remote_debugging: unbounded allocation when a profiling binary file declares oversized table counts","articleBody":"# Bug report\n\n## Bug description\n\nThe binary profile reader in `_remote_debugging` (used by `python -m\nprofiling.sampling` to replay `.pyb` files) reads the string-table and\nframe-table entry counts from the file footer and allocates arrays of that size\n*before* validating the counts against the amount of data actually present in\nthe file:\n\n- `reader_parse_string_table` does `PyMem_Calloc(strings_count, sizeof(PyObject *))`\n- `reader_parse_frame_table` does `PyMem_Malloc(frames_count * sizeof(FrameEntry))`\n\n`strings_count` / `frames_count` are 32-bit values taken from the footer, so a\ntiny file can declare up to `2**32 - 1` entries and make the reader attempt a\nmulti-gigabyte allocation (up to ~120 GB for the frame table). Opening the file\nis enough; no valid sample data is required.\n\nThis is reachable from the CLI: `python -m profiling.sampling replay \u003cfile>` and\n`--diff-flamegraph \u003cbaseline>` both open a user-supplied `.pyb` through\n`_remote_debugging.BinaryReader`, and the `replay` input check only validates\nthe magic number, not the footer.\n\n## Reproducer\n\n```python\nimport _remote_debugging, struct, os, tempfile\n\nfn = tempfile.mktemp(suffix=\".pyb\")\nw = _remote_debugging.BinaryWriter(fn, 1000, 0, compression=0)\nw.finalize()                        # minimal valid file, no samples\nsize = os.path.getsize(fn)\n\n# footer is the last 32 bytes; the frame count is a u32 at footer offset 4\nwith open(fn, \"r+b\") as f:\n    f.seek(size - 32 + 4)\n    f.write(struct.pack(\"\u003cI\", 0xFFFFFFFF))\n\n_remote_debugging.BinaryReader(fn)  # attempts a ~120 GB allocation\n```\n\nOn an unpatched build this drives the process to several gigabytes of RSS (and\ncan hang) from a ~100-byte file. The string table is affected the same way via\n`strings_count` (footer offset 0).\n\n## Expected behavior\n\nThe reader should reject a declared count that cannot be backed by the file's\nbytes with a `ValueError`, the same way the RLE sample count is already bounded\nin `binary_reader_replay`.\n\nThis is a sibling of gh-148252, which hardened the same reader against malformed\n`.pyb` files; the eager string/frame table allocations were not covered there.\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-152719\n* gh-153050\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/tonghuaroot","@type":"Person","name":"tonghuaroot"},"datePublished":"2026-07-01T02:14:06Z","url":"https://github.com/python/cpython/issues/152718"}

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:aa90449c-9d03-4fb8-5551-09f805399aa7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA57C:2454CC:43582DA:5555A55:6B022F75
html-safe-nonce44f88fe57af31f2986f24320402b26c8b6762d47351b6e14558245404498c18c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTdDOjI0NTRDQzo0MzU4MkRBOjU1NTVBNTU6NkIwMjJGNzUiLCJ2aXNpdG9yX2lkIjoiMjI3ODMzMzAyMzkyMzYxMzU1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac3cebc202c0f819e3beacf5fceb0ac62f375cfb1f5eefc29f345121cbcd9cb111
hovercard-subject-tagissue:4781798413
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/152718/issue_layout
twitter:imagehttps://opengraph.githubassets.com/99c28f1370c2de4a8fcb9863bd0bbc29cb809e269b7fa070b43521574b103215/python/cpython/issues/152718
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/99c28f1370c2de4a8fcb9863bd0bbc29cb809e269b7fa070b43521574b103215/python/cpython/issues/152718
og:image:altBug report Bug description The binary profile reader in _remote_debugging (used by python -m profiling.sampling to replay .pyb files) reads the string-table and frame-table entry counts from the fi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametonghuaroot
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/152718#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F152718
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%2F152718
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/152718
Reloadhttps://github.com/python/cpython/issues/152718
Reloadhttps://github.com/python/cpython/issues/152718
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/152718
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/152718
_remote_debugging: unbounded allocation when a profiling binary file declares oversized table countshttps://github.com/python/cpython/issues/152718#top
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
topic-profilinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-profiling%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/tonghuaroot
tonghuaroothttps://github.com/tonghuaroot
on Jul 1, 2026https://github.com/python/cpython/issues/152718#issue-4781798413
gh-148252https://github.com/python/cpython/issues/148252
gh-152718: Reject oversized table counts in the profiling binary reader #152719https://github.com/python/cpython/pull/152719
[3.15] gh-152718: Reject oversized table counts in the profiling binary reader (GH-152719) #153050https://github.com/python/cpython/pull/153050
tonghuaroothttps://github.com/tonghuaroot
on Jul 1, 2026https://github.com/python/cpython/issues/152718#event-27406785168
pythongh-152718: Tighten comments and shorten the NEWS entryhttps://github.com/tonghuaroot/cpython/commit/ffe26437edc2432510b7db1f9bef026823430af6
pythongh-152718https://github.com/python/cpython/issues/152718
ffe2643https://github.com/tonghuaroot/cpython/commit/ffe26437edc2432510b7db1f9bef026823430af6
StanFromIrelandhttps://github.com/StanFromIreland
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
on Jul 1, 2026https://github.com/python/cpython/issues/152718#event-27421993325
tonghuaroothttps://github.com/tonghuaroot
on Jul 2, 2026https://github.com/python/cpython/issues/152718#event-27457789838
pythongh-152718: Factor the reader count checks into reader_validate_…https://github.com/tonghuaroot/cpython/commit/572947c8b64723282c0fd0a1ff8fa0fa4db2bf2d
pythongh-152718https://github.com/python/cpython/issues/152718
572947chttps://github.com/tonghuaroot/cpython/commit/572947c8b64723282c0fd0a1ff8fa0fa4db2bf2d
serhiy-storchakahttps://github.com/serhiy-storchaka
topic-profilinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-profiling%22
on Jul 3, 2026https://github.com/python/cpython/issues/152718#event-27545884169
pablogsalhttps://github.com/pablogsal
on Jul 4, 2026https://github.com/python/cpython/issues/152718#event-27564500654
gh-152718: Reject oversized table counts in the profiling binary read…https://github.com/python/cpython/commit/8e580b068500feec5d6cc5e5a3e6072e8996fb25
gh-152718https://github.com/python/cpython/issues/152718
8e580b0https://github.com/python/cpython/commit/8e580b068500feec5d6cc5e5a3e6072e8996fb25
[3.15] gh-152718: Reject oversized table counts in the profiling bina…https://github.com/python/cpython/commit/41a2abe06d6e77c1ecbb7cf455a8cff59988debe
gh-152718https://github.com/python/cpython/issues/152718
41a2abehttps://github.com/python/cpython/commit/41a2abe06d6e77c1ecbb7cf455a8cff59988debe
StanFromIrelandhttps://github.com/StanFromIreland
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jul 6, 2026https://github.com/python/cpython/issues/152718#event-27597130763
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/152718
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/152718
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
topic-profilinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-profiling%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%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.