Source: python-msgpack
Version: 1.2.1-3
Severity: serious
X-Debbugs-Cc: [email protected]
Dear Maintainer,
The autopkgtest invocation of the upstream unittests fails for
python-msgpack. It fails both on ci.d.n with its mixed testing/unstable
setup and also locally when freshly rebuilt and then immediately run only
against packages from unstable. I've not investigated further as to why
(or how).
//---
65s =================================== FAILURES
===================================
65s _______________ test_unpacker_no_refcount_underflow_after_error
________________
65s
65s def test_unpacker_no_refcount_underflow_after_error() -> None:
65s """Regression test (CVE-2026-114613): after a failed skip(), the C
65s extension must not drop a stale reference to a previously returned
65s object (use-after-free)."""
65s up = Unpacker()
65s up.feed(packb({"a": [1, 2, 3]}, use_bin_type=True))
65s outer = up.unpack()
65s inner = outer["a"]
65s keep = inner # safety reference keeping the probe object alive
65s gc.collect()
65s r1 = sys.getrefcount(inner)
65s
65s # Two nested fixarray headers then an invalid byte: skip() opens
two
65s # containers without writing the stack slots, then fails, and the
65s # cleanup must not touch the stale slot left by the previous
unpack().
65s up.feed(b"\x92\x92\xc1")
65s with raises(Exception):
65s up.skip()
65s gc.collect()
65s
65s assert sys.getrefcount(inner) == r1
65s # The parser context must be reusable afterwards: the same
operation
65s # fails cleanly again (no corrupt-state crash), and after
realigning
65s # past the rejected byte the unpacker resumes normally.
65s with raises(FormatError):
65s > up.skip()
65s
65s test/test_except.py:216:
65s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _
65s msgpack/fallback.py:585: in skip
65s self._unpack(EX_SKIP)
65s msgpack/fallback.py:489: in _unpack
65s typ, n, obj = self._read_header()
65s ^^^^^^^^^^^^^^^^^^^
65s msgpack/fallback.py:396: in _read_header
65s self._reserve(1)
65s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _
65s
65s self = <msgpack.fallback.Unpacker object at 0x7f5b5e5b2030>, n = 1
65s raise_outofdata = True
65s
65s def _reserve(self, n, raise_outofdata=True):
65s remain_bytes = len(self._buffer) - self._buff_i - n
65s
65s # Fast path: buffer has n bytes already
65s if remain_bytes >= 0:
65s return
65s
65s if self._feeding:
65s self._buff_i = self._buf_checkpoint
65s > raise OutOfData
65s E msgpack.exceptions.OutOfData
65s
65s msgpack/fallback.py:367: OutOfData
65s =========================== short test summary info
============================
65s FAILED test/test_except.py::test_unpacker_no_refcount_underflow_after_error
65s =================== 1 failed, 130 passed, 2 skipped in 1.77s
===================
---//
The failure above is with Python 3.14 so this is not related to the
on-going work to add Python 3.15 as a supported interpreter (but it will
get in the way of that transition at some stage).
regards
Stuart