cpython: 1cd68b3c46aa (original) (raw)
Mercurial > cpython
changeset 94278:1cd68b3c46aa
Issue #23321: Fixed a crash in str.decode() when error handler returned replacment string longer than mailformed input data. [#23321]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Mon, 26 Jan 2015 01:24:31 +0200 |
parents | dd8a03e98158(current diff)2de90090e486(diff) |
children | 20f54cdf351d |
files | Misc/NEWS Objects/unicodeobject.c |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-)[+] [-] Misc/NEWS 3 Objects/unicodeobject.c 8 |
line wrap: on
line diff
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Release date: TBA Core and Builtins ----------------- +- Issue #23321: Fixed a crash in str.decode() when error handler returned
--- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -4155,9 +4155,13 @@ unicode_decode_call_errorhandler_writer( if (PyUnicode_READY(repunicode) < 0) goto onError; replen = PyUnicode_GET_LENGTH(repunicode);
- if (replen > 1) {
writer->min_length += replen - 1;[](#l2.10) writer->overallocate = 1;[](#l2.11)
if (_PyUnicodeWriter_Prepare(writer, writer->min_length,[](#l2.12)
PyUnicode_MAX_CHAR_VALUE(repunicode)) == -1)[](#l2.13)
goto onError;[](#l2.14)
- } if (_PyUnicodeWriter_WriteStr(writer, repunicode) == -1) goto onError;