]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-36398: Fix a possible crash in structseq_repr(). (GH-12492)
authorZackery Spytz <zspytz@gmail.com>
Fri, 22 Mar 2019 07:24:34 +0000 (01:24 -0600)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 22 Mar 2019 07:24:34 +0000 (09:24 +0200)
If the first PyUnicode_DecodeUTF8() call fails in structseq_repr(),
_PyUnicodeWriter_Dealloc() will be called on an uninitialized
_PyUnicodeWriter.

Misc/NEWS.d/next/Core and Builtins/2019-03-21-22-19-38.bpo-36398.B_jXGe.rst [new file with mode: 0644]
Objects/structseq.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-03-21-22-19-38.bpo-36398.B_jXGe.rst b/Misc/NEWS.d/next/Core and Builtins/2019-03-21-22-19-38.bpo-36398.B_jXGe.rst
new file mode 100644 (file)
index 0000000..2b00283
--- /dev/null
@@ -0,0 +1 @@
+Fix a possible crash in ``structseq_repr()``.
index 5278313ffdce6d8f864dcaadf87f5fecc2c216a1..cf36fa7f97c00c3f99d9606338cf14f62063d43e 100644 (file)
@@ -176,7 +176,7 @@ structseq_repr(PyStructSequence *obj)
                                                strlen(typ->tp_name),
                                                NULL);
     if (type_name == NULL) {
-        goto error;
+        return NULL;
     }
 
     _PyUnicodeWriter_Init(&writer);