[New-bugs-announce] [issue31626] Crash in _PyUnicode_DecodeUnicodeEscape on OpenBSD

Serhiy Storchaka report at bugs.python.org
Fri Sep 29 02:29:10 EDT 2017

New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

I tried to build CPython on 64-bit OpenBSD. It was built successfully, but tests crash. They crash on importing hashlib. Actually on compiling hashlib docstring. Minimal reproducer is:

$ ./python -c 'import codecs; codecs.decode(r"\\"*15 + "x"*1906, "unicode-escape")'                  
assertion "maxchar < 128" failed: file "Objects/unicodeobject.c", line 474, function "_PyUnicode_CheckConsistency"
Abort trap (core dumped) 

_PyUnicodeWriter_Finish() calls resize_compact() for truncating the result, but the latter fills the last 15 bytes with \xdb. Since the string is tagged as ASCII, thus crashing in _PyUnicode_CheckConsistency.

components: Interpreter Core
messages: 303302
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Crash in _PyUnicode_DecodeUnicodeEscape on OpenBSD
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list