Xiang Zhang <angwe...@126.com> added the comment: Another way to crash:
>>> import codecs >>> def replace_with_longer(exc): ... exc.object = b'\xa0\x00' * 100 ... return ('\ufffd', exc.end) ... >>> codecs.register codecs.register( codecs.register_error( >>> codecs.register_error('replace_with_longer', rep replace_with_longer( repr( >>> codecs.register_error('replace_with_longer', replace_with_longer) >>> b'\xd8\xd8'.decode('utf-16-le', 'replace_with_longer') Debug memory block at address p=0x10b3b8c40: API 'o' 92 bytes originally requested The 7 pad bytes at p-7 are FORBIDDENBYTE, as expected. The 8 pad bytes at tail=0x10b3b8c9c are not all FORBIDDENBYTE (0xfb): at tail+0: 0xa0 *** OUCH at tail+1: 0x00 *** OUCH at tail+2: 0xa0 *** OUCH at tail+3: 0x00 *** OUCH at tail+4: 0xa0 *** OUCH at tail+5: 0x00 *** OUCH at tail+6: 0xa0 *** OUCH at tail+7: 0x00 *** OUCH The block was made by call #11529390970613309440 to debug malloc/realloc. Data at p: 00 00 00 00 00 00 00 00 ... 00 00 00 00 fd ff a0 00 Fatal Python error: bad trailing pad byte Current thread 0x00007fffab9b4340 (most recent call first): File "/Users/angwer/Repositories/cpython/Lib/encodings/utf_16_le.py", line 16 in decode File "<stdin>", line 1 in <module> [1] 64081 abort ~/Repositories/cpython/python.exe ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32583> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com