Title: Found Heap-use-after-free errors and SEGV in Python · Issue #103824 · python/cpython · GitHub
Open Graph Title: Found Heap-use-after-free errors and SEGV in Python · Issue #103824 · python/cpython
X Title: Found Heap-use-after-free errors and SEGV in Python · Issue #103824 · python/cpython
Description: Your environment CPython versions tested on: 3.12.0 alpha 7 Operating system and architecture: ubuntu20.04.1,x86_64 Compiler flags: clang with ASAN and UBSAN instrument Bug description The AddressSanitizer (ASAN) tool has detected multip...
Open Graph Description: Your environment CPython versions tested on: 3.12.0 alpha 7 Operating system and architecture: ubuntu20.04.1,x86_64 Compiler flags: clang with ASAN and UBSAN instrument Bug description The AddressS...
X Description: Your environment CPython versions tested on: 3.12.0 alpha 7 Operating system and architecture: ubuntu20.04.1,x86_64 Compiler flags: clang with ASAN and UBSAN instrument Bug description The AddressS...
Opengraph URL: https://github.com/python/cpython/issues/103824
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Found Heap-use-after-free errors and SEGV in Python","articleBody":"# Your environment\r\n\r\n- CPython versions tested on: 3.12.0 alpha 7\r\n- Operating system and architecture: ubuntu20.04.1,x86_64\r\n- Compiler flags: clang with ASAN and UBSAN instrument\r\n\r\n# Bug description\r\nThe AddressSanitizer (ASAN) tool has detected multiple heap-use-after-free errors and a segmentation fault (SEGV) in the Python interpreter. The heap-use-after-free errors occurred in the ascii_decode and unicode_decode_utf8 functions in the unicodeobject.c file, and the SEGV occurred in the tok_backup function in the tokenizer.c file. Additionally, a memory leak was detected in the pystate.c file.\r\n\r\n# Steps to reproduce\r\n\r\n1. Compile Python with ASAN enabled: `./configure \u0026\u0026 make`\r\n1. Run Python with ASAN enabled: `./python \u003c poc_file`\r\n1. The heap-use-after-free errors and SEGV should be detected and logged by ASAN.\r\n\r\n# Expected behavior\r\n\r\nNo heap-use-after-free errors or SEGV should occur.\r\n\r\n# Actual behavior\r\n\r\nASAN detected multiple heap-use-after-free errors and a SEGV, as well as a memory leak.\r\n\r\n# Relevant logs and/or screenshots\r\n\r\nThe ASAN summary output is as follows:\r\n\r\n```\r\nAddressSanitizer: heap-use-after-free /src/cpython/Objects/unicodeobject.c:4474:28 in ascii_decode\r\nAddressSanitizer: heap-use-after-free /src/cpython/Objects/unicodeobject.c:4506:28 in ascii_decode\r\nAddressSanitizer: heap-use-after-free /src/cpython/Objects/unicodeobject.c:4483:32 in ascii_decode\r\nAddressSanitizer: SEGV /src/cpython/Parser/tokenizer.c:1234:33 in tok_backup\r\nAddressSanitizer: heap-use-after-free /src/cpython/Objects/unicodeobject.c:4526:37 in unicode_decode_utf8\r\nAddressSanitizer: 3824 byte(s) leaked in 4 allocation(s).\r\nAddressSanitizer: heap-use-after-free /src/cpython/Python/pystate.c:229:23 in bind_tstate\r\nThe full ASAN log can be found in the asan.log file.\r\n```\r\n[asan.log](https://github.com/python/cpython/files/11316179/asan.log)\r\n[python_bug_poc.zip](https://github.com/python/cpython/files/11316193/python_bug_poc.zip)\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-103993\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/JohenanLi","@type":"Person","name":"JohenanLi"},"datePublished":"2023-04-25T03:35:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/103824/cpython/issues/103824"}
| 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:bcad9c27-e6ec-90d0-a835-4a35288e205e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A1DE:66035:BFF180:107B735:6969F30E |
| html-safe-nonce | cdad4aa9e05a1329f20a8a9a2897c576ba2534b44268e9811b24c37e63aeaeea |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMURFOjY2MDM1OkJGRjE4MDoxMDdCNzM1OjY5NjlGMzBFIiwidmlzaXRvcl9pZCI6IjQ2OTAyNjMwMDA5MjcwNDAyNzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2e4de79135811c3e2302c2140b25c9cc7e1da6602d0b60142f6147dfaddc5e7b |
| hovercard-subject-tag | issue:1682372017 |
| 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/103824/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be8578858f57da7604a73f2a4008a51a3962e04f08250efe271498a21b41f2f4/python/cpython/issues/103824 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be8578858f57da7604a73f2a4008a51a3962e04f08250efe271498a21b41f2f4/python/cpython/issues/103824 |
| og:image:alt | Your environment CPython versions tested on: 3.12.0 alpha 7 Operating system and architecture: ubuntu20.04.1,x86_64 Compiler flags: clang with ASAN and UBSAN instrument Bug description The AddressS... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JohenanLi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| 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 | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width