-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python implementation of json.loads()
accepts invalid unicode escapes
#125660
Comments
Maybe something like this? Although it might be a better idea to use a stricter function. esc = s[end:end + 4].strip()
if "_" not in esc and len(esc) == 4 and esc[0] not in "+-" and esc[1] not in "xX": |
Either this, or simply use regexp. |
Let's use a regex, unicode digits aren't allowed either: >>> int("\uff10", 16)
0 |
Could there be other code that suffers from this problem? |
Possibly, but that's out of context for this issue. If someone finds such issues they should be reported separately. |
…tion of JSON decoder (pythonGH-125683) (cherry picked from commit df75136) Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
…tion of JSON decoder (pythonGH-125683) (cherry picked from commit df75136) Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
…pickler and unpickler pickle.Pickler and pickle.Unpickler instances have now managed dicts. Arbitrary instance attributes, including persistent_id and persistent_load, can now be set.
…tion of JSON decoder (pythonGH-125683)
Bug report
Bug description:
While reviewing #125652 and reading the documentation of
int()
, I realised this condition injson.decoder
is insufficient:cpython/Lib/json/decoder.py
Line 61 in f203d1c
CPython versions tested on:
3.13
Operating systems tested on:
macOS
Linked PRs
json.loads()
accepts invalid unicode escapes #125683The text was updated successfully, but these errors were encountered: