summaryrefslogtreecommitdiff
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-10-03 08:15:49 +0000
committerMark Dickinson <dickinsm@gmail.com>2009-10-03 08:15:49 +0000
commitc3a12775e26f8c8f4148cb247dc88bc38f05dc58 (patch)
tree09ad84efb85f3136839cbeb285f05a9f7916fb6e /Python/marshal.c
parent7664bfe4e2540f07651372075d3179ab2f93988b (diff)
downloadcpython-git-c3a12775e26f8c8f4148cb247dc88bc38f05dc58.tar.gz
Issue #7019: An attempt to unmarshal bad long data could produce
unnormalized PyLong objects; make it raise ValueError instead.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 52d22573d3..a4c831f261 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -589,7 +589,8 @@ r_object(RFILE *p)
ob->ob_size = n;
for (i = 0; i < size; i++) {
int digit = r_short(p);
- if (digit < 0) {
+ if (digit < 0 ||
+ (digit == 0 && i == size-1)) {
Py_DECREF(ob);
PyErr_SetString(PyExc_ValueError,
"bad marshal data");