Closed
Description
When a serialization error happens, msgpack.Packer
buffer is not reset and left in a partially written state. Immediate (without manually calling Packer.reset()
) reuse of the packer leads to silently producing invalid msgpack data.
Reproduction:
>>> import msgpack
>>> p = msgpack.Packer()
>>> p.pack({0: msgpack})
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "msgpack/_packer.pyx", line 223, in msgpack._packer.Packer.pack (msgpack/_packer.cpp:223)
File "msgpack/_packer.pyx", line 225, in msgpack._packer.Packer.pack (msgpack/_packer.cpp:225)
File "msgpack/_packer.pyx", line 184, in msgpack._packer.Packer._pack (msgpack/_packer.cpp:184)
File "msgpack/_packer.pyx", line 220, in msgpack._packer.Packer._pack (msgpack/_packer.cpp:220)
TypeError: can't serialize <module 'msgpack' from '/usr/lib/python3.3/site-packages/msgpack/__init__.py'>
>>> p.pack(None)
b'\x81\x00\xc0'
>>> msgpack.packb(None)
b'\xc0'
Metadata
Metadata
Assignees
Labels
No labels