]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-148252: Fix stack depth calculation in binary reader on 32-bit platforms (#148253)
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Mon, 13 Apr 2026 22:43:55 +0000 (23:43 +0100)
committerGitHub <noreply@github.com>
Mon, 13 Apr 2026 22:43:55 +0000 (23:43 +0100)
commiteb4c78df07c87237f97e4c3e6f583fd4155821b3
tree99e8756b263cd343174e7fd142788a591e53220b
parent2662db0c45aa16232136628457a53681b6683c25
gh-148252: Fix stack depth calculation in binary reader on 32-bit platforms (#148253)

Compute ``final_depth`` in ``decode_stack_pop_push()`` and
``decode_stack_suffix()`` using ``uint64_t`` before validating it.

On 32-bit builds, using ``size_t`` arithmetic for ``keep + push`` can wrap
for large input values, causing the later bounds check to validate the wrong
final depth. Using a widened type keeps the validation aligned with the
actual result.
Misc/NEWS.d/next/Security/2026-04-08-14-25-47.gh-issue-148252.IEp9Rt.rst [new file with mode: 0644]
Modules/_remote_debugging/binary_io_reader.c