]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 25 Oct 2016 07:07:51 +0000 (10:07 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 25 Oct 2016 07:07:51 +0000 (10:07 +0300)
Misc/NEWS
Objects/unicodeobject.c

index 3c117db4c80bfd286dcce5e314f59c6b8385c00b..513989afee0e07ed16cc312f890cf522bfaffc3c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ Release date: TBA
 Core and Builtins
 -----------------
 
+- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug
+  build.
+
 Library
 -------
 
index 193d898f1b2760b91e0bd3d56fe6aa158db7cb52..7fad69541b3ed902643906685de392df9ba2c3f7 100644 (file)
@@ -3059,24 +3059,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 *