diff options
author | INADA Naoki <inada-n@klab.com> | 2012-12-29 01:39:59 +0900 |
---|---|---|
committer | INADA Naoki <inada-n@klab.com> | 2012-12-29 01:39:59 +0900 |
commit | 72416e403c6d70b6fbc4ea8e05e1fe7f02a6561a (patch) | |
tree | 9874a48273c5869993cd31dbab4ac7f426a77633 /msgpack/_msgpack.pyx | |
parent | 9dc299bd8da75e61f512e6ba50bd06face71f8a0 (diff) | |
download | msgpack-python-0.2.tar.gz |
Fix unpacker doesn't raise exception for invalid input.0.2
Diffstat (limited to 'msgpack/_msgpack.pyx')
-rw-r--r-- | msgpack/_msgpack.pyx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/msgpack/_msgpack.pyx b/msgpack/_msgpack.pyx index 5feba11..78b2aa7 100644 --- a/msgpack/_msgpack.pyx +++ b/msgpack/_msgpack.pyx @@ -210,7 +210,7 @@ cdef extern from "unpack.h": PyObject* key int template_execute(template_context* ctx, const_char_ptr data, - size_t len, size_t* off, bint construct) except -1 + size_t len, size_t* off, bint construct) except? -1 void template_init(template_context* ctx) object template_data(template_context* ctx) @@ -285,6 +285,8 @@ def unpackb(object packed, object object_hook=None, object list_hook=None, if off < buf_len: raise ValueError("Extra data.") return obj + elif ret < 0: + raise ValueError("Unpack failed: error = %d" % (ret,)) else: return None |