mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-08 13:31:01 +00:00
Fix unpacker doesn't raise exception for invalid input.
This commit is contained in:
parent
9dc299bd8d
commit
72416e403c
2 changed files with 9 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue