New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

Based on discussion in PR 660.

_PyUnicodeWriter_Prepare() is used incorrectly in 
unicode_decode_call_errorhandler_writer(), _PyUnicode_DecodeUnicodeEscape() and 
PyUnicode_DecodeRawUnicodeEscape() in Objects/unicodeobject.c. The second 
argument is the number of characters that should be reserved after the current 
position. But in these places the total minimal size is passed to 
_PyUnicodeWriter_Prepare(). This can lead to allocating more memory than 
necessary.

----------
components: Interpreter Core, Unicode
messages: 312038
nosy: ezio.melotti, serhiy.storchaka, vstinner, xiang.zhang
priority: normal
severity: normal
status: open
title: Fix incorrect usage of _PyUnicodeWriter_Prepare()
type: resource usage
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to