Title: _PyPegen_raise_error_known_location() uses wrong build format · Issue #95876 · python/cpython · GitHub
Open Graph Title: _PyPegen_raise_error_known_location() uses wrong build format · Issue #95876 · python/cpython
X Title: _PyPegen_raise_error_known_location() uses wrong build format · Issue #95876 · python/cpython
Description: Bug report _PyPegen_raise_error_known_location() uses Py_BuildValue() to generate a tuple for SyntaxError. The format string uses wrong values for all integer constants. lineno, col_number, end_lineno, and end_col_number are Py_ssize_t. ...
Open Graph Description: Bug report _PyPegen_raise_error_known_location() uses Py_BuildValue() to generate a tuple for SyntaxError. The format string uses wrong values for all integer constants. lineno, col_number, end_lin...
X Description: Bug report _PyPegen_raise_error_known_location() uses Py_BuildValue() to generate a tuple for SyntaxError. The format string uses wrong values for all integer constants. lineno, col_number, end_lin...
Opengraph URL: https://github.com/python/cpython/issues/95876
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"_PyPegen_raise_error_known_location() uses wrong build format","articleBody":"# Bug report\r\n\r\n`_PyPegen_raise_error_known_location()` uses `Py_BuildValue()` to generate a tuple for SyntaxError. The format string uses wrong values for all integer constants. lineno, col_number, end_lineno, and end_col_number are Py_ssize_t. The `i` format string handles int. This causes memory corruption on 64bit operation systems with strict ABI (e.g. wasm64).\r\n\r\nhttps://github.com/python/cpython/blob/b9e956fccf60e2083d63bdfa30d7e04c910e94c2/Parser/pegen_errors.c#L373-L376\r\n\r\nI can reliable crash the interpreter with a syntax error like `1+=1`. Notice the `\u003censc object at 0x1>` in the object dump.\r\n\r\n```\r\n$ node --experimental-wasm-memory64 ./python.js -c \"1+=1\"\r\n File \"\u003cstring>\", line 1\r\nobject address : 0x973e10\r\nobject refcount : 2\r\nobject type : 0x2bc868\r\nobject type name: SyntaxError\r\nobject repr : SyntaxError(\"'literal' is an illegal expression for augmented assignment\", ('\u003cstring>', 1, 0, \u003censc object at 0x1>, 10590200, 0))\r\nlost sys.stderr\r\nAborted(Runtime error: The application has corrupted its heap memory area (address zero)!)\r\nexiting due to exception: RuntimeError: Aborted(Runtime error: The application has corrupted its heap memory area (address zero)!),RuntimeError: Aborted(Runtime error: The application has corrupted its heap memory area (address zero)!)\r\n at abort (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:971:11)\r\n at checkStackCookie (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:733:47)\r\n at exitRuntime (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:800:3)\r\n at exitJS (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:7254:9)\r\n at callMain (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:9476:5)\r\n at doRun (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:9525:23)\r\n at run (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:9540:5)\r\n at runCaller (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:9448:19)\r\n at removeRunDependency (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:936:7)\r\n at receiveInstance (/home/heimes/dev/python/cpython/builddir/wasm64-emscripten-node-debug/python.js:1106:5)\r\n```\r\n\r\nThe fix is trivial, use `n` instead of `i`. https://docs.python.org/3/c-api/arg.html#c.Py_BuildValue\r\n\r\n# Your environment\r\n\r\nCPython main\r\nwasm64-emscripten (EMSDK 3.1.18) with Node 16","author":{"url":"https://github.com/tiran","@type":"Person","name":"tiran"},"datePublished":"2022-08-11T07:16:59Z","url":"https://github.com/python/cpython/issues/95876"}
| 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:0e1b5441-92a4-143e-6f88-ecc7bc563637 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C9C6:14700E:4AE7BBA:5EDFC92:6B02524A |
| html-safe-nonce | 1685f1b381b9c121cad98d1f09c32dfc2e13d5cf52fef1f0733aaaf49c78e5e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUM2OjE0NzAwRTo0QUU3QkJBOjVFREZDOTI6NkIwMjUyNEEiLCJ2aXNpdG9yX2lkIjoiNzMwMzAzNTY3NzQ5MzU4MDM2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bd3143566824fe7983a8837b9cf88468b1308eeb954d02e975f879f51c95a2b1 |
| hovercard-subject-tag | issue:1335564981 |
| 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/95876/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bce770171981742a03a22d5a2c976a5b39e3669cbccb891e302f2fc772a6a934/python/cpython/issues/95876 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bce770171981742a03a22d5a2c976a5b39e3669cbccb891e302f2fc772a6a934/python/cpython/issues/95876 |
| og:image:alt | Bug report _PyPegen_raise_error_known_location() uses Py_BuildValue() to generate a tuple for SyntaxError. The format string uses wrong values for all integer constants. lineno, col_number, end_lin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tiran |
| 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