]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-71810: Fix _PyLong_AsByteArray() undefined behavior (GH-138873) (#138883)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 7 Oct 2025 17:38:40 +0000 (19:38 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Oct 2025 17:38:40 +0000 (19:38 +0200)
commitb343009377b632cd07863475e33238b592d984f5
treecb7f79466df6c85643bb04b064d728372e2a5e4c
parent52e88585b0e667b4ba4a8cd4a06228ea969587fe
[3.14] gh-71810: Fix _PyLong_AsByteArray() undefined behavior (GH-138873) (#138883)

gh-71810: Fix _PyLong_AsByteArray() undefined behavior (GH-138873)

Don't read p[-1] when p is an empty string: when n==0.
(cherry picked from commit 8b5ce31c2b44d9bf82e6119e90a52dd530bfd1db)

Co-authored-by: Victor Stinner <vstinner@python.org>
Objects/longobject.c