[3.12] gh-125660: Reject invalid unicode escapes for Python implementation of JSON decoder (GH-125683) (GH-125695)

(cherry picked from commit df751363e3)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-10-21 15:08:10 +02:00 committed by GitHub
parent 18196fea89
commit 2746ec4ce2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 4 deletions

View file

@ -116,6 +116,11 @@ class TestScanstring:
'"\\u012z"',
'"\\u0x12"',
'"\\u0X12"',
'"\\u{0}"'.format("\uff10" * 4),
'"\\u 123"',
'"\\u-123"',
'"\\u+123"',
'"\\u1_23"',
'"\\ud834\\"',
'"\\ud834\\u"',
'"\\ud834\\ud"',
@ -127,6 +132,11 @@ class TestScanstring:
'"\\ud834\\udd2z"',
'"\\ud834\\u0x20"',
'"\\ud834\\u0X20"',
'"\\ud834\\u{0}"'.format("\uff10" * 4),
'"\\ud834\\u 123"',
'"\\ud834\\u-123"',
'"\\ud834\\u+123"',
'"\\ud834\\u1_23"',
]
for s in bad_escapes:
with self.assertRaises(self.JSONDecodeError, msg=s):