mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
fix possible overflow in encode_basestring_ascii (closes #23369)
This commit is contained in:
parent
4dbc305002
commit
e3bfe19358
3 changed files with 25 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
from collections import OrderedDict
|
||||
from test.test_json import PyTest, CTest
|
||||
from test.support import bigaddrspacetest
|
||||
|
||||
|
||||
CASES = [
|
||||
|
@ -41,4 +42,10 @@ class TestEncodeBasestringAscii:
|
|||
|
||||
|
||||
class TestPyEncodeBasestringAscii(TestEncodeBasestringAscii, PyTest): pass
|
||||
class TestCEncodeBasestringAscii(TestEncodeBasestringAscii, CTest): pass
|
||||
class TestCEncodeBasestringAscii(TestEncodeBasestringAscii, CTest):
|
||||
@bigaddrspacetest
|
||||
def test_overflow(self):
|
||||
s = "\uffff"*((2**32)//6 + 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
self.json.encoder.encode_basestring_ascii(s)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue