summaryrefslogtreecommitdiff
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2005-06-13 18:28:46 +0000
committerMichael W. Hudson <mwh@python.net>2005-06-13 18:28:46 +0000
commit57659535cc889c0fb9da55f77c74f4115f449243 (patch)
tree240ae9b4f6947c34bff60aae96e0938e497033cd /Python/marshal.c
parent4e2af9b11b0d47162c25b920a37faa3f1954cf1e (diff)
downloadcpython-57659535cc889c0fb9da55f77c74f4115f449243.tar.gz
Fix bug
[ 1180997 ] lax error-checking in new-in-2.4 marshal stuff which I'd assigned to Martin, but actually turned out to be easy to fix. Also, a test.
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 6c65700966..7f38a467f9 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;