[Python-checkins] bpo-36398: Fix a possible crash in structseq_repr(). (GH-12492)

Serhiy Storchaka webhook-mailer at python.org
Fri Mar 22 03:24:43 EDT 2019


https://github.com/python/cpython/commit/93e8012f2cabd84f30b52e19fd3dc557efa9f8af
commit: 93e8012f2cabd84f30b52e19fd3dc557efa9f8af
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2019-03-22T09:24:34+02:00
summary:

bpo-36398: Fix a possible crash in structseq_repr(). (GH-12492)

If the first PyUnicode_DecodeUTF8() call fails in structseq_repr(),
_PyUnicodeWriter_Dealloc() will be called on an uninitialized
_PyUnicodeWriter.

files:
A Misc/NEWS.d/next/Core and Builtins/2019-03-21-22-19-38.bpo-36398.B_jXGe.rst
M 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
index 000000000000..2b00283096f2
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-03-21-22-19-38.bpo-36398.B_jXGe.rst	
@@ -0,0 +1 @@
+Fix a possible crash in ``structseq_repr()``.
diff --git a/Objects/structseq.c b/Objects/structseq.c
index 5278313ffdce..cf36fa7f97c0 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -176,7 +176,7 @@ structseq_repr(PyStructSequence *obj)
                                                strlen(typ->tp_name),
                                                NULL);
     if (type_name == NULL) {
-        goto error;
+        return NULL;
     }
 
     _PyUnicodeWriter_Init(&writer);



More information about the Python-checkins mailing list