]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.7] gh-97616: list_resize() checks for integer overflow (GH-97617) (#97629)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 5 Oct 2022 21:55:53 +0000 (14:55 -0700)
committerGitHub <noreply@github.com>
Wed, 5 Oct 2022 21:55:53 +0000 (14:55 -0700)
commitfd82f16c1e4d9a0661e9a2250004032797652e69
treef646a56991b90c369d15c689e9af5af0f48e66f7
parent98884f523d783ecd9933c1ca52d80fbbd7d6bdf5
[3.7] gh-97616: list_resize() checks for integer overflow (GH-97617) (#97629)

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