summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-23 22:31:47 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-23 22:31:47 (GMT)
commit47ccf0cbbaa4797d9d32c51c70d51a711a8d5fe0 (patch)
treee68f31fc90c12bbc7707f41f103c1fc4125c9d65 /Modules
parentce28a01e350bee803bbddab873090e59fb9d0c4c (diff)
downloadcpython-47ccf0cbbaa4797d9d32c51c70d51a711a8d5fe0.zip
cpython-47ccf0cbbaa4797d9d32c51c70d51a711a8d5fe0.tar.gz
cpython-47ccf0cbbaa4797d9d32c51c70d51a711a8d5fe0.tar.bz2
Merged revisions 74189 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74189 | amaury.forgeotdarc | 2009-07-23 21:26:02 +0200 (jeu., 23 juil. 2009) | 4 lines #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 1cef5c1..8fa4a66 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;
}