diff options
author | Xiang Zhang <angwerzx@126.com> | 2017-05-09 11:38:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-09 11:38:32 +0800 |
commit | 9da408d15bdef624a5632182cb4edf98001fa82f (patch) | |
tree | 55707952ef7b86c4c333122add2bc27101c27ef0 /Lib/test | |
parent | fa5abac1e6cd74979557d5a6f960a55f40a10b0e (diff) | |
download | cpython-git-9da408d15bdef624a5632182cb4edf98001fa82f.tar.gz |
bpo-29990: Fix range checking in GB18030 decoder (#1495)
When decoding a 4-byte GB18030 sequence, the first and third byte cannot exceed 0xFE.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_codecencodings_cn.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py index 3bdf7d0e14..c8a410c2e0 100644 --- a/Lib/test/test_codecencodings_cn.py +++ b/Lib/test/test_codecencodings_cn.py @@ -48,6 +48,12 @@ class Test_GB18030(multibytecodec_support.TestBase, unittest.TestCase): (b"abc\x84\x32\x80\x80def", "replace", 'abc\ufffd2\ufffd\ufffddef'), (b"abc\x81\x30\x81\x30def", "strict", 'abc\x80def'), (b"abc\x86\x30\x81\x30def", "replace", 'abc\ufffd0\ufffd0def'), + # issue29990 + (b"\xff\x30\x81\x30", "strict", None), + (b"\x81\x30\xff\x30", "strict", None), + (b"abc\x81\x39\xff\x39\xc1\xc4", "replace", "abc\ufffd\x39\ufffd\x39\u804a"), + (b"abc\xab\x36\xff\x30def", "replace", 'abc\ufffd\x36\ufffd\x30def'), + (b"abc\xbf\x38\xff\x32\xc1\xc4", "ignore", "abc\x38\x32\u804a"), ) has_iso10646 = True |