Title: profiling.sampling heatmap reads non-regular and oversized files · Issue #153838 · python/cpython · GitHub
Open Graph Title: profiling.sampling heatmap reads non-regular and oversized files · Issue #153838 · python/cpython
X Title: profiling.sampling heatmap reads non-regular and oversized files · Issue #153838 · python/cpython
Description: Bug description The heatmap exporter in profiling.sampling reads source files named in a profile unconditionally via Path(filename).read_text(). It does not check whether the path is a regular file or whether the file size is reasonable....
Open Graph Description: Bug description The heatmap exporter in profiling.sampling reads source files named in a profile unconditionally via Path(filename).read_text(). It does not check whether the path is a regular file...
X Description: Bug description The heatmap exporter in profiling.sampling reads source files named in a profile unconditionally via Path(filename).read_text(). It does not check whether the path is a regular file...
Opengraph URL: https://github.com/python/cpython/issues/153838
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"profiling.sampling heatmap reads non-regular and oversized files","articleBody":"### Bug description\n\nThe heatmap exporter in `profiling.sampling` reads source files named in a profile unconditionally via `Path(filename).read_text()`. It does not check whether the path is a regular file or whether the file size is reasonable.\n\nWhen replaying a binary profile, a filename pointing to a device file (e.g. `/dev/zero`) causes unbounded memory growth. An oversized file has the same effect.\n\nThe fix adds an `is_file()` guard and a 10 MB size cap before reading, consistent with the binary reader hardening in gh-152718.\n\n### CPython versions tested on\n\nmain\n\n### Operating systems tested on\n\nmacOS\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-153839\n* gh-158853\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/tonghuaroot","@type":"Person","name":"tonghuaroot"},"datePublished":"2026-07-17T09:58:57Z","url":"https://github.com/python/cpython/issues/153838"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a6fc4c14-4a19-d54c-83bc-f150c2a6f9f2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9C08:2F543F:1ACF6CF:236B94C:6B021B9D |
| html-safe-nonce | ef5a3c5840b1bbf2928c8c8e74e0b096ac0041e9dd8c607e9f184f1f41f837bd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzA4OjJGNTQzRjoxQUNGNkNGOjIzNkI5NEM6NkIwMjFCOUQiLCJ2aXNpdG9yX2lkIjoiNjg0MjQyMTA5ODA4NTIyNzQyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1d9073f68ba21f4d7fc22714a3dfd9f8f902f10cd6aef27bc0bbd6c03325bc9e |
| hovercard-subject-tag | issue:4910233626 |
| 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/153838/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c0c48ef38751654e2d84cbcf3b9d3f63906eaa2652d5e194792b66b2f6d7ddc3/python/cpython/issues/153838 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c0c48ef38751654e2d84cbcf3b9d3f63906eaa2652d5e194792b66b2f6d7ddc3/python/cpython/issues/153838 |
| og:image:alt | Bug description The heatmap exporter in profiling.sampling reads source files named in a profile unconditionally via Path(filename).read_text(). It does not check whether the path is a regular file... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tonghuaroot |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width