Title: Python implementation of `json.loads()` accepts invalid unicode escapes · Issue #125660 · python/cpython · GitHub
Open Graph Title: Python implementation of `json.loads()` accepts invalid unicode escapes · Issue #125660 · python/cpython
X Title: Python implementation of `json.loads()` accepts invalid unicode escapes · Issue #125660 · python/cpython
Description: Bug report Bug description: While reviewing #125652 and reading the documentation of int(), I realised this condition in json.decoder is insufficient: cpython/Lib/json/decoder.py Line 61 in f203d1c if len(esc) == 4 and esc[1] not in 'xX'...
Open Graph Description: Bug report Bug description: While reviewing #125652 and reading the documentation of int(), I realised this condition in json.decoder is insufficient: cpython/Lib/json/decoder.py Line 61 in f203d1c...
X Description: Bug report Bug description: While reviewing #125652 and reading the documentation of int(), I realised this condition in json.decoder is insufficient: cpython/Lib/json/decoder.py Line 61 in f203d1c...
Opengraph URL: https://github.com/python/cpython/issues/125660
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python implementation of `json.loads()` accepts invalid unicode escapes","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nWhile reviewing #125652 and reading the documentation of [`int()`](https://docs.python.org/3/library/functions.html#int), I realised this condition in `json.decoder` is insufficient:\r\n\r\nhttps://github.com/python/cpython/blob/f203d1cb52f7697140337a73841c8412282e2ee0/Lib/json/decoder.py#L61\r\n\r\n```python\r\n>>> import sys\r\n>>> sys.modules[\"_json\"] = None\r\n>>> import json\r\n>>> json.loads(r'[\"\\u 000\", \"\\u-000\", \"\\u+000\", \"\\u0_00\"]')\r\n['\\x00', '\\x00', '\\x00', '\\x00']\r\n```\r\n\r\n### CPython versions tested on:\r\n\r\n3.13\r\n\r\n### Operating systems tested on:\r\n\r\nmacOS\r\n\r\n\u003c!-- gh-linked-prs -->\r\n### Linked PRs\r\n* gh-125683\r\n* gh-125694\r\n* gh-125695\r\n\u003c!-- /gh-linked-prs -->\r\n","author":{"url":"https://github.com/nineteendo","@type":"Person","name":"nineteendo"},"datePublished":"2024-10-17T17:57:30Z","url":"https://github.com/python/cpython/issues/125660"}
| 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:863a3a41-8925-0644-95c1-a12bff211dd6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80A6:3DD488:45A0BF6:5856BAA:6B023F34 |
| html-safe-nonce | 0916b85e154439393fd1469f727da69c87a2685d94cf346a0320aad456e1f991 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEE2OjNERDQ4ODo0NUEwQkY2OjU4NTZCQUE6NkIwMjNGMzQiLCJ2aXNpdG9yX2lkIjoiNzU5MTU3OTY4MDc0NzE3NTczMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 40ba876aae9be576db73dd96442f44714008261d27601bd4a3581f0addb79aac |
| hovercard-subject-tag | issue:2595385225 |
| 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/125660/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a868043cef0b70bde7241f9d0d533050fdc5db8d4359edc34ba3dcfdbfa1a602/python/cpython/issues/125660 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a868043cef0b70bde7241f9d0d533050fdc5db8d4359edc34ba3dcfdbfa1a602/python/cpython/issues/125660 |
| og:image:alt | Bug report Bug description: While reviewing #125652 and reading the documentation of int(), I realised this condition in json.decoder is insufficient: cpython/Lib/json/decoder.py Line 61 in f203d1c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nineteendo |
| 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