mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-04-09 21:10:18 +00:00
Add missing autoreset in Packer.pack_ext_type
pack_ext_type writes to the internal buffer but never checks self._autoreset, unlike every other public pack method. This means it always returns None and the packed data leaks into the output of the next pack() call, corrupting the serialized stream. Add the same autoreset pattern used by pack(), pack_map_pairs(), pack_array_header(), and pack_map_header().
This commit is contained in:
parent
f9806368ae
commit
b691a8e52c
1 changed files with 4 additions and 0 deletions
|
|
@ -861,6 +861,10 @@ class Packer:
|
|||
self._buffer.write(b"\xc9" + struct.pack(">I", L))
|
||||
self._buffer.write(struct.pack("B", typecode))
|
||||
self._buffer.write(data)
|
||||
if self._autoreset:
|
||||
ret = self._buffer.getvalue()
|
||||
self._buffer = BytesIO()
|
||||
return ret
|
||||
|
||||
def _pack_array_header(self, n):
|
||||
if n <= 0x0F:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue