Title: Some object-to-AST conversions are missing error checks · Issue #105588 · python/cpython · GitHub
Open Graph Title: Some object-to-AST conversions are missing error checks · Issue #105588 · python/cpython
X Title: Some object-to-AST conversions are missing error checks · Issue #105588 · python/cpython
Description: The generated code in Python-ast.c is missing error checks following the construction of C-level alias, arg, comprehension, keyword, match_item, and withitem nodes from their Python object counterparts. This means it's possible to crash ...
Open Graph Description: The generated code in Python-ast.c is missing error checks following the construction of C-level alias, arg, comprehension, keyword, match_item, and withitem nodes from their Python object counterp...
X Description: The generated code in Python-ast.c is missing error checks following the construction of C-level alias, arg, comprehension, keyword, match_item, and withitem nodes from their Python object counterp...
Opengraph URL: https://github.com/python/cpython/issues/105588
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Some object-to-AST conversions are missing error checks","articleBody":"The generated code in `Python-ast.c` is missing error checks following the construction of C-level `alias`, `arg`, `comprehension`, `keyword`, `match_item`, and `withitem` nodes from their Python object counterparts. This means it's possible to crash the interpreter by attempting to compile an AST where a required member of these nodes is replaced with `None`:\r\n\r\n```py\r\n\u003e\u003e\u003e import ast\r\n\u003e\u003e\u003e tree = ast.parse(\"\"\"\r\n... match ...:\r\n... case THIS:\r\n... ...\r\n... \"\"\")\r\n\u003e\u003e\u003e tree.body[0].cases[0].pattern = None\r\n\u003e\u003e\u003e compile(tree, \"\u003ccrash\u003e\", \"exec\")\r\nSegmentation fault\r\n```\r\n\r\nI'll have a PR up in a minute with the one-line fix.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-105589\n* gh-105838\n* gh-105839\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/brandtbucher","@type":"Person","name":"brandtbucher"},"datePublished":"2023-06-09T19:01:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/105588/cpython/issues/105588"}
| 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:10b6cd4b-f18b-4420-153d-709ddbb1d2b0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C82C:C2480:252EA2E:32FD211:696ACA6F |
| html-safe-nonce | 3609d448c9c24daaac4cc24491563e2302e915ed2934dafe8ce751dcae3dcd91 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODJDOkMyNDgwOjI1MkVBMkU6MzJGRDIxMTo2OTZBQ0E2RiIsInZpc2l0b3JfaWQiOiI1NTI3NTMyNDg1NDc5MTU2MzM1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 759e03495e6dfa52c94d1604d40898a65a3cd5d2b133b4a0c938964b4107957d |
| hovercard-subject-tag | issue:1750366008 |
| 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/105588/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ec7d680be69fd6290c0730ec04a4bb46a5c8544659da44bc826a776b3032ffaf/python/cpython/issues/105588 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ec7d680be69fd6290c0730ec04a4bb46a5c8544659da44bc826a776b3032ffaf/python/cpython/issues/105588 |
| og:image:alt | The generated code in Python-ast.c is missing error checks following the construction of C-level alias, arg, comprehension, keyword, match_item, and withitem nodes from their Python object counterp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brandtbucher |
| hostname | github.com |
| expected-hostname | github.com |
| None | c785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d |
| 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 | c718a376fcf780eb22089171adb84a543f660bf7 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width