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

Skip to content

Commit 0a7697b

Browse files
author
Kristján Valur Jónsson
committed
Catch a few extra error cases in marshal.c
1 parent 26e066d commit 0a7697b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Python/marshal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,8 @@ r_object(RFILE *p)
12971297
if (name == NULL)
12981298
goto code_error;
12991299
firstlineno = (int)r_long(p);
1300+
if (firstlineno == -1 && PyErr_Occurred())
1301+
break;
13001302
lnotab = r_object(p);
13011303
if (lnotab == NULL)
13021304
goto code_error;
@@ -1326,6 +1328,8 @@ r_object(RFILE *p)
13261328
case TYPE_REF:
13271329
n = r_long(p);
13281330
if (n < 0 || n >= PyList_GET_SIZE(p->refs)) {
1331+
if (n == -1 && PyErr_Occurred())
1332+
break;
13291333
PyErr_SetString(PyExc_ValueError, "bad marshal data (invalid reference)");
13301334
break;
13311335
}

0 commit comments

Comments
 (0)