Skip to content

Commit 93e8012

Browse files
ZackerySpytzserhiy-storchaka
authored andcommitted
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.
1 parent 9a0000d commit 93e8012

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a possible crash in ``structseq_repr()``.

Objects/structseq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ structseq_repr(PyStructSequence *obj)
176176
strlen(typ->tp_name),
177177
NULL);
178178
if (type_name == NULL) {
179-
goto error;
179+
return NULL;
180180
}
181181

182182
_PyUnicodeWriter_Init(&writer);

0 commit comments

Comments
 (0)