Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.

This commit is contained in:
Serhiy Storchaka 2016-10-25 10:18:16 +03:00
commit d7e5ff13bb
2 changed files with 5 additions and 10 deletions

View File

@ -10,6 +10,9 @@ What's New in Python 3.7.0 alpha 1
Core and Builtins
-----------------
- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug
build.
- Issue #28517: Fixed of-by-one error in the peephole optimizer that caused
keeping unreachable code.

View File

@ -3232,24 +3232,16 @@ PyUnicode_AsDecodedObject(PyObject *unicode,
const char *encoding,
const char *errors)
{
PyObject *v;
if (!PyUnicode_Check(unicode)) {
PyErr_BadArgument();
goto onError;
return NULL;
}
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
/* Decode via the codec registry */
v = PyCodec_Decode(unicode, encoding, errors);
if (v == NULL)
goto onError;
return unicode_result(v);
onError:
return NULL;
return PyCodec_Decode(unicode, encoding, errors);
}
PyObject *