From 89ce16df39f67ac77785a63b4111c353f0a606a3 Mon Sep 17 00:00:00 2001 From: Alexei Romanoff Date: Fri, 12 Oct 2012 12:32:32 +0300 Subject: A segfault fixed in the issue https://github.com/msgpack/msgpack-python/issues/28 --- msgpack/unpack.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'msgpack/unpack.h') diff --git a/msgpack/unpack.h b/msgpack/unpack.h index 5ec7dbc..61e5d91 100644 --- a/msgpack/unpack.h +++ b/msgpack/unpack.h @@ -207,6 +207,9 @@ static inline int template_callback_map_end(unpack_user* u, msgpack_unpack_objec { if (u->object_hook) { PyObject *new_c = PyEval_CallFunction(u->object_hook, "(O)", *c); + if (!new_c) + return -1; + Py_DECREF(*c); *c = new_c; } -- cgit v1.2.1 From cf89f18be7614d6d55bb9eb7e9bf0e10d42a8508 Mon Sep 17 00:00:00 2001 From: Alexei Romanoff Date: Fri, 12 Oct 2012 13:19:53 +0300 Subject: segfault fixed when data is unpacked using `list_hook`, this bug is a twin to #28. Unit-test is also attached. --- msgpack/unpack.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'msgpack/unpack.h') diff --git a/msgpack/unpack.h b/msgpack/unpack.h index 61e5d91..3dc88e5 100644 --- a/msgpack/unpack.h +++ b/msgpack/unpack.h @@ -163,6 +163,8 @@ static inline int template_callback_array_end(unpack_user* u, msgpack_unpack_obj { if (u->list_hook) { PyObject *new_c = PyEval_CallFunction(u->list_hook, "(O)", *c); + if (!new_c) + return -1; Py_DECREF(*c); *c = new_c; } -- cgit v1.2.1