]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-97616: list_resize() checks for integer overflow (GH-97617)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 28 Sep 2022 22:28:38 +0000 (15:28 -0700)
committerGitHub <noreply@github.com>
Wed, 28 Sep 2022 22:28:38 +0000 (15:28 -0700)
commit7d60d10b6342f3fa7af1a65a6eba10d49945e769
treeb3a64d7f691c7458da37766b8fdb018e147479d4
parent744087474b0f3a42d05a874dcb8d09be2e312a0e
gh-97616: list_resize() checks for integer overflow (GH-97617)

Fix multiplying a list by an integer (list *= int): detect the
integer overflow when the new allocated length is close to the
maximum size.  Issue reported by Jordan Limor.

list_resize() now checks for integer overflow before multiplying the
new allocated length by the list item size (sizeof(PyObject*)).
(cherry picked from commit a5f092f3c469b674b8d9ccbd4e4377230c9ac7cf)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/test_list.py
Misc/NEWS.d/next/Security/2022-09-28-17-09-37.gh-issue-97616.K1e3Xs.rst [new file with mode: 0644]
Objects/listobject.c