]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-101037: Fix potential memory underallocation for zeros of int subtypes (#101038)
authorMark Dickinson <dickinsm@gmail.com>
Sat, 21 Jan 2023 10:23:59 +0000 (10:23 +0000)
committerGitHub <noreply@github.com>
Sat, 21 Jan 2023 10:23:59 +0000 (10:23 +0000)
commit401fdf9c851eb61229250ebffa942adca99b36d1
tree01afb0dae67636403b5955f4aef8ddddd6a21568
parent9e947675ae3dc32f5863e5ed3022301cf7fd79b4
gh-101037: Fix potential memory underallocation for zeros of int subtypes (#101038)

This PR fixes object allocation in long_subtype_new to ensure that there's at least one digit in all cases, and makes sure that the value of that digit is copied over from the source long.

Needs backport to 3.11, but not any further: the change to require at least one digit was only introduced for Python 3.11.

Fixes #101037.
Include/cpython/longintrepr.h
Misc/NEWS.d/next/Core and Builtins/2023-01-14-17-03-08.gh-issue-101037.9ATNuf.rst [new file with mode: 0644]
Objects/longobject.c