summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-23 19:26:02 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-23 19:26:02 (GMT)
commit74b301678315068f4e1283fadcc5232cc94426ca (patch)
tree82d97fa060675f230739859b2f800b47b6afae3a /Modules
parent617a5588d1e5d0ad4cf791646c053064df74aea2 (diff)
downloadcpython-74b301678315068f4e1283fadcc5232cc94426ca.zip
cpython-74b301678315068f4e1283fadcc5232cc94426ca.tar.gz
cpython-74b301678315068f4e1283fadcc5232cc94426ca.tar.bz2
#6553: crash in cPickle.load(), when given a StringIO with incomplete data.
Will backport to 2.6, 3.x already fixed a similar issue with issue4298.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cPickle.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 486e86f..a849424 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -663,6 +663,12 @@ read_other(Unpicklerobject *self, char **s, Py_ssize_t n)
self->last_string = str;
if (! (*s = PyString_AsString(str))) return -1;
+
+ if (PyString_GET_SIZE(str) != n) {
+ PyErr_SetNone(PyExc_EOFError);
+ return -1;
+ }
+
return n;
}