cpython/Include/cpython
Miss Islington (bot) d2aaf818ae
[3.11] gh-101037: Fix potential memory underallocation for zeros of int subtypes (GH-101038) (#101219)
gh-101037: Fix potential memory underallocation for zeros of int subtypes (GH-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 GH-101037.
(cherry picked from commit 401fdf9c85)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2023-01-21 10:54:09 +00:00
..
abstract.h gh-92781: Avoid mixing declarations and code in C API (#92783) (#92813) 2022-05-16 13:19:52 +02:00
bytearrayobject.h gh-89653: PEP 670: Convert PyBytes macros to functions (#91990) 2022-05-03 20:14:58 +02:00
bytesobject.h gh-89653: PEP 670: Convert PyBytes macros to functions (#91990) 2022-05-03 20:14:58 +02:00
cellobject.h bpo-45476: Add _Py_RVALUE() macro (GH-29860) 2021-11-30 12:14:45 +01:00
ceval.h Revert "bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API (GH-32052)" (GH-32343) 2022-04-06 13:58:07 +02:00
classobject.h bpo-35134: Move classobject.h to Include/cpython/ (GH-28968) 2021-10-15 09:46:29 +02:00
code.h gh-94936: C getters: co_varnames, co_cellvars, co_freevars (GH-95008) 2022-08-04 07:16:52 -07:00
compile.h bpo-46521: Fix codeop to use a new partial-input mode of the parser (GH-31010) 2022-02-08 11:54:37 +00:00
complexobject.h bpo-35134: Add Include/cpython/complexobject.h header (GH-32383) 2022-04-07 01:05:27 +02:00
context.h bpo-35134: Move classobject.h to Include/cpython/ (GH-28968) 2021-10-15 09:46:29 +02:00
descrobject.h bpo-45459: C API uses type names rather than structure names (GH-31528) 2022-02-24 17:51:59 +01:00
dictobject.h Revert "[3.11] GH-92678: Expose managed dict clear and visit functions (GH-95246). (#95256)" (#95647) 2022-08-04 13:03:07 +01:00
fileobject.h bpo-41986: Add Py_FileSystemDefaultEncodeErrors and Py_UTF8Mode back to limited API (GH-22621) 2020-10-10 17:09:45 +03:00
fileutils.h bpo-46303: Move fileutils.h private functions to internal C API (GH-30484) 2022-01-11 11:56:16 +01:00
floatobject.h bpo-46906: Add PyFloat_Pack8() to the C API (GH-31657) 2022-03-12 00:10:02 +01:00
frameobject.h gh-93937, C API: Move PyFrame_GetBack() to Python.h (#93938) (#94000) 2022-06-20 15:47:41 +02:00
funcobject.h bpo-45316: Move private functions to internal C API (GH-31579) 2022-02-25 16:07:14 +01:00
genobject.h bpo-47045: Remove f_state field (GH-31963) 2022-03-22 12:57:19 +00:00
import.h [3.11] gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742) (GH-93792) 2022-06-14 08:51:39 +03:00
initconfig.h gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542) 2022-05-06 01:34:11 +02:00
listobject.h gh-89653: PEP 670: Use PyObject* type for parameters (GH-92694) 2022-05-11 16:23:29 -07:00
longintrepr.h [3.11] gh-101037: Fix potential memory underallocation for zeros of int subtypes (GH-101038) (#101219) 2023-01-21 10:54:09 +00:00
longobject.h bpo-35134: Add Include/cpython/longobject.h (GH-29044) 2021-10-19 02:04:52 +02:00
methodobject.h gh-89653: PEP 670: Convert PyCFunction macros to functions (#92302) 2022-05-05 11:31:59 +02:00
modsupport.h gh-79315: Add Include/cpython/modsupport.h header (#91797) 2022-04-21 23:00:26 +02:00
object.h [3.11] Revert "[3.11] gh-98724: Fix Py_CLEAR() macro side effects (#99100)" (#99573) 2022-11-21 18:01:10 +01:00
objimpl.h bpo-40170: Remove _Py_GetAllocatedBlocks() function (GH-30940) 2022-01-27 03:35:51 +01:00
odictobject.h bpo-35134: Move non-limited C API files to Include/cpython/ (GH-24561) 2021-02-19 15:55:46 +01:00
picklebufobject.h bpo-35134: Move non-limited C API files to Include/cpython/ (GH-24561) 2021-02-19 15:55:46 +01:00
pthread_stubs.h [3.11] gh-95174: Add pthread stubs for WASI (GH-95234) (#95503) 2022-08-01 15:37:45 +01:00
pyctype.h bpo-43816: Add extern "C" to Include/cpython/pyctype.h (GH-25365) 2021-04-13 13:27:21 +02:00
pydebug.h bpo-45434: Convert Py_GETENV() macro to a function (GH-28912) 2021-10-13 03:39:50 +02:00
pyerrors.h gh-89770: Implement PEP-678 - Exception notes (GH-31317) 2022-04-16 19:59:52 +01:00
pyfpe.h bpo-35134: Move non-limited C API files to Include/cpython/ (GH-24561) 2021-02-19 15:55:46 +01:00
pyframe.h gh-93937, C API: Move PyFrame_GetBack() to Python.h (#93938) (#94000) 2022-06-20 15:47:41 +02:00
pylifecycle.h bpo-43795: Remove Py_FrozenMain from the Limited API & Stable ABI (GH-26241) 2021-05-25 04:42:03 -07:00
pymem.h bpo-43795: PEP-652: Clean up the stable ABI/limited API (GH-25482) 2021-04-23 14:17:58 +02:00
pystate.h GH-91719: Make MSVC generate somewhat faster switch code (#91718) 2022-04-21 11:53:57 -07:00
pythonrun.h bpo-43868: Remove PyOS_ReadlineFunctionPointer from the stable ABI list (GH-25442) 2021-04-23 14:23:38 +02:00
pythread.h [3.11] gh-95174: Add pthread stubs for WASI (GH-95234) (#95503) 2022-08-01 15:37:45 +01:00
pytime.h Fix typos in the Include directory (GH-28745) 2021-10-06 11:32:38 -07:00
setobject.h bpo-35134: Add Include/cpython/setobject.h header (GH-32384) 2022-04-07 01:26:24 +02:00
sysmodule.h bpo-46987: Remove _PySys_GetObjectId / _PySys_GetObjectId (GH-31835) 2022-03-14 21:48:00 +09:00
traceback.h bpo-45459: C API uses type names rather than structure names (GH-31528) 2022-02-24 17:51:59 +01:00
tupleobject.h gh-89653: PEP 670: Use PyObject* type for parameters (GH-92694) 2022-05-11 16:23:29 -07:00
unicodeobject.h gh-89653: PEP 670: Fix PyUnicode_READ() cast (GH-92872) 2022-05-17 10:45:55 -07:00
warnings.h bpo-35134: Split warnings.h and weakrefobject.h (GH-29042) 2021-10-19 01:31:57 +02:00
weakrefobject.h gh-92781: Avoid mixing declarations and code in C API (#92783) (#92813) 2022-05-16 13:19:52 +02:00