]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-71810: Fix _PyLong_AsByteArray() undefined behavior (GH-138873) (#138884)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 14 Sep 2025 09:49:23 +0000 (11:49 +0200)
committerGitHub <noreply@github.com>
Sun, 14 Sep 2025 09:49:23 +0000 (09:49 +0000)
commita9020589de6321310720ca550f48793ab5b42d93
tree5e991c8fcc5cffa3ed4fff354912db2b4b1a8197
parenta5f7e02ddf59518eadea1325db7e33217341b59b
[3.13] gh-71810: Fix _PyLong_AsByteArray() undefined behavior (GH-138873) (#138884)

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