There was an error while loading. Please reload this page.
1 parent 9f9bdae commit 2e4be09Copy full SHA for 2e4be09
2 files changed
msgpack/fallback.py
@@ -582,7 +582,10 @@ def __next__(self):
582
next = __next__
583
584
def skip(self):
585
- self._unpack(EX_SKIP)
+ try:
586
+ self._unpack(EX_SKIP)
587
+ except RecursionError:
588
+ raise StackError
589
self._consume()
590
591
def unpack(self):
test/test_except.py
@@ -97,6 +97,11 @@ def test_invalidvalue():
97
with raises(StackError):
98
unpackb(b"\x91" * 3000) # nested fixarray(len=1)
99
100
+ with raises(StackError):
101
+ unpacker = Unpacker()
102
+ unpacker.feed(b"\x91" * 3000)
103
+ unpacker.skip()
104
+
105
106
def test_no_memory_leak_on_nested_invalid_tag() -> None:
107
"""Regression test: unpacking nested arrays containing an invalid tag must not leak objects."""
0 commit comments