Kaydet (Commit) d5cae6f1 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #19437: Fix r_object() of marshal module, handle PyDict_SetItem() failure

for TYPE_DICT and stop immedialty on first r_object() failure
üst b1b7b183
......@@ -1117,6 +1117,7 @@ r_object(RFILE *p)
R_REF(v);
if (v == NULL)
break;
for (i = 0; i < n; i++) {
v2 = r_object(p);
if ( v2 == NULL ) {
......@@ -1170,10 +1171,17 @@ r_object(RFILE *p)
if (key == NULL)
break;
val = r_object(p);
if (val != NULL)
PyDict_SetItem(v, key, val);
if (val == NULL) {
Py_DECREF(key);
break;
}
if (PyDict_SetItem(v, key, val) < 0) {
Py_DECREF(key);
Py_DECREF(val);
break;
}
Py_DECREF(key);
Py_XDECREF(val);
Py_DECREF(val);
}
if (PyErr_Occurred()) {
Py_DECREF(v);
......@@ -1204,6 +1212,7 @@ r_object(RFILE *p)
}
if (v == NULL)
break;
for (i = 0; i < n; i++) {
v2 = r_object(p);
if ( v2 == NULL ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment