diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-04-14 02:10:38 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-04-14 02:10:38 (GMT) |
commit | 99b5afab74428e5ddfd877bdf3aa8a8c479696b1 (patch) | |
tree | 44293ac5d0a038577e6d671f2488126ef3cab7eb /Lib/test | |
parent | 80e6af1f61f2d63ff45ada00be841db9ad5e6c9f (diff) | |
download | cpython-99b5afab74428e5ddfd877bdf3aa8a8c479696b1.zip cpython-99b5afab74428e5ddfd877bdf3aa8a8c479696b1.tar.gz cpython-99b5afab74428e5ddfd877bdf3aa8a8c479696b1.tar.bz2 |
in scan_once, prevent the reading of arbitrary memory when passed a negative index
Bug reported by Guido Vranken.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/json_tests/test_decode.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/json_tests/test_decode.py b/Lib/test/json_tests/test_decode.py index 15a427f..a3d7b08 100644 --- a/Lib/test/json_tests/test_decode.py +++ b/Lib/test/json_tests/test_decode.py @@ -70,5 +70,9 @@ class TestDecode: msg = 'escape' self.assertRaisesRegex(ValueError, msg, self.loads, s) + def test_negative_index(self): + d = self.json.JSONDecoder() + self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000) + class TestPyDecode(TestDecode, PyTest): pass class TestCDecode(TestDecode, CTest): pass |