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.
This commit is contained in:
Zackery Spytz 2019-03-22 01:24:34 -06:00 committed by Serhiy Storchaka
parent 9a0000d15d
commit 93e8012f2c
2 changed files with 2 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix a possible crash in ``structseq_repr()``.

View 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);