summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 6c65700..7f38a46 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -648,6 +648,10 @@ r_object(RFILE *p)
case TYPE_STRINGREF:
n = r_long(p);
+ if (n < 0 || n >= PyList_GET_SIZE(p->strings)) {
+ PyErr_SetString(PyExc_ValueError, "bad marshal data");
+ return NULL;
+ }
v = PyList_GET_ITEM(p->strings, n);
Py_INCREF(v);
return v;