This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xiang.zhang
Recipients benjamin.peterson, ezio.melotti, lemburg, serhiy.storchaka, sibiryakov, terry.reedy, vstinner, xiang.zhang
Date 2018-01-20.19:55:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516478151.72.0.467229070634.issue32583@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-01-20 19:55:51xiang.zhangsetrecipients: + xiang.zhang, lemburg, terry.reedy, vstinner, benjamin.peterson, ezio.melotti, serhiy.storchaka, sibiryakov
2018-01-20 19:55:51xiang.zhangsetmessageid: <1516478151.72.0.467229070634.issue32583@psf.upfronthosting.co.za>
2018-01-20 19:55:51xiang.zhanglinkissue32583 messages
2018-01-20 19:55:51xiang.zhangcreate