Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6d6917b

Browse files
author
Michael W. Hudson
committed
Fix a couple of crashing-on-malformed data marshal bugs.
1 parent 451ae18 commit 6d6917b

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Python/marshal.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,13 +632,13 @@ r_object(RFILE *p)
632632
return NULL;
633633
}
634634
v = PyString_FromStringAndSize((char *)NULL, n);
635-
if (v != NULL) {
636-
if (r_string(PyString_AS_STRING(v), (int)n, p) != n) {
637-
Py_DECREF(v);
638-
v = NULL;
639-
PyErr_SetString(PyExc_EOFError,
635+
if (v == NULL)
636+
return v;
637+
if (r_string(PyString_AS_STRING(v), (int)n, p) != n) {
638+
Py_DECREF(v);
639+
PyErr_SetString(PyExc_EOFError,
640640
"EOF read where object expected");
641-
}
641+
return NULL;
642642
}
643643
if (type == TYPE_INTERNED) {
644644
PyString_InternInPlace(&v);
@@ -766,6 +766,8 @@ r_object(RFILE *p)
766766
}
767767
PyTuple_SET_ITEM(v, (int)i, v2);
768768
}
769+
if (v == NULL)
770+
return v;
769771
if (type == TYPE_SET)
770772
v3 = PyObject_CallFunctionObjArgs(
771773
(PyObject *)&PySet_Type, v, NULL);

0 commit comments

Comments
 (0)