summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2005-06-03 15:17:16 (GMT)
committerMichael W. Hudson <mwh@python.net>2005-06-03 15:17:16 (GMT)
commit6d6917be00942734fc8665a2398bd06087115729 (patch)
tree33687617c0be7e40d5c3fe07165bcd303206785a /Python/marshal.c
parent451ae18751671a8964f29df18a8b10f94ba55946 (diff)
downloadcpython-6d6917be00942734fc8665a2398bd06087115729.zip
cpython-6d6917be00942734fc8665a2398bd06087115729.tar.gz
cpython-6d6917be00942734fc8665a2398bd06087115729.tar.bz2
Fix a couple of crashing-on-malformed data marshal bugs.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c14
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);