diff options
author | Michael W. Hudson <mwh@python.net> | 2005-06-03 15:17:16 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2005-06-03 15:17:16 (GMT) |
commit | 6d6917be00942734fc8665a2398bd06087115729 (patch) | |
tree | 33687617c0be7e40d5c3fe07165bcd303206785a /Python | |
parent | 451ae18751671a8964f29df18a8b10f94ba55946 (diff) | |
download | cpython-6d6917be00942734fc8665a2398bd06087115729.zip cpython-6d6917be00942734fc8665a2398bd06087115729.tar.gz cpython-6d6917be00942734fc8665a2398bd06087115729.tar.bz2 |
Fix a couple of crashing-on-malformed data marshal bugs.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/marshal.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Python/marshal.c b/Python/marshal.c index 2535cb5..59aabac 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -632,13 +632,13 @@ r_object(RFILE *p) return NULL; } v = PyString_FromStringAndSize((char *)NULL, n); - if (v != NULL) { - if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { - Py_DECREF(v); - v = NULL; - PyErr_SetString(PyExc_EOFError, + if (v == NULL) + return v; + if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { + Py_DECREF(v); + PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - } + return NULL; } if (type == TYPE_INTERNED) { PyString_InternInPlace(&v); @@ -766,6 +766,8 @@ r_object(RFILE *p) } PyTuple_SET_ITEM(v, (int)i, v2); } + if (v == NULL) + return v; if (type == TYPE_SET) v3 = PyObject_CallFunctionObjArgs( (PyObject *)&PySet_Type, v, NULL); |