From 3796c38f1f448214698533a358add947d85847f9 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith [Google LLC]" Date: Wed, 8 Feb 2023 15:55:03 -0800 Subject: [PATCH] gh-101180: PR demonstrating the ASAN failure To make it easy to reproduce. Build your PR branch using: `./configure --with-address-sanitizer && make` --- Lib/test/test_codecencodings_jp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Lib/test/test_codecencodings_jp.py b/Lib/test/test_codecencodings_jp.py index 94378d124f7485..5f702cbf6f2e46 100644 --- a/Lib/test/test_codecencodings_jp.py +++ b/Lib/test/test_codecencodings_jp.py @@ -122,5 +122,15 @@ class Test_SJISX0213(multibytecodec_support.TestBase, unittest.TestCase): b"\x85Gℜ\x85Q = ⟨ሴ⟩" ) + +class Test_iso2022_jp_2004(unittest.TestCase): + def test_gh101180(self): + import codecs + crashfile_txt = b'8N=d\xcf\x844\x11\x1b\x1b\x0b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b_\x0b\x0b]*\xca\x8c\x01\x00\x00P\x1bK\xf1\x94\xa1\x96' + text = crashfile_txt.decode('utf-8') + # This would trigger a crash or ASAN failure per the original report. + codecs.encode(text, encoding='iso2022_jp_2004', errors='ignore') + + if __name__ == "__main__": unittest.main()