cpython/Objects
Gregory P. Smith f8b71da9aa
[3.11] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96500)
Integer to and from text conversions via CPython's bignum `int` type is not safe against denial of service attacks due to malicious input. Very large input strings with hundred thousands of digits can consume several CPU seconds.

This PR comes fresh from a pile of work done in our private PSRT security response team repo.

This backports https://github.com/python/cpython/pull/96499 aka 511ca94520

Signed-off-by: Christian Heimes [Red Hat] <christian@python.org>
Tons-of-polishing-up-by: Gregory P. Smith [Google] <greg@krypto.org>
Reviews via the private PSRT repo via many others (see the NEWS entry in the PR).

<!-- gh-issue-number: gh-95778 -->
* Issue: gh-95778
<!-- /gh-issue-number -->

I wrote up [a one pager for the release managers](https://docs.google.com/document/d/1KjuF_aXlzPUxTK4BMgezGJ2Pn7uevfX7g0_mvgHlL7Y/edit#).
2022-09-02 09:48:57 -07:00
..
clinic gh-91320: Argument Clinic uses _PyCFunction_CAST() (#32210) 2022-05-03 20:25:41 +02:00
stringlib gh-84461: Silence some compiler warnings on WASM (GH-93978) 2022-06-20 05:08:14 -07:00
abstract.c Use static inline function Py_EnterRecursiveCall() (#91988) 2022-05-04 13:30:23 +02:00
accu.c bpo-35081: Move accu.h to Include/internal/pycore_accu.h (GH-10271) 2018-11-01 02:30:36 +01:00
boolobject.c GH-90699: fix ref counting of static immortal strings (gh-94850) 2022-07-19 23:56:47 -07:00
bytearrayobject.c GH-91153: Handle mutating __index__ methods in bytearray item assignment (GH-94891) 2022-07-19 10:12:39 -07:00
bytes_methods.c bpo-43179: Generalise alignment for optimised string routines (GH-24624) 2021-03-31 12:12:39 +02:00
bytesobject.c Use static inline function Py_EnterRecursiveCall() (#91988) 2022-05-04 13:30:23 +02:00
call.c Use static inline function Py_EnterRecursiveCall() (#91988) 2022-05-04 13:30:23 +02:00
capsule.c bpo-45855: document that no_block has no use anymore in PyCapsule_Import (#29665) 2021-12-12 10:49:50 +01:00
cellobject.c bpo-40268: Remove unused pycore_pymem.h includes (GH-19531) 2020-04-15 02:57:50 +02:00
classobject.c bpo-46764: Fix wrapping bound method with @classmethod (#31367) 2022-05-04 23:00:21 -05:00
codeobject.c GH-96187: Prevent _PyCode_GetExtra to return garbage for negative indexes (GH-96188) 2022-08-23 04:02:19 -07:00
complexobject.c bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. (gh-30928) 2022-02-08 13:39:07 -07:00
descrobject.c Use static inline function Py_EnterRecursiveCall() (#91988) 2022-05-04 13:30:23 +02:00
dictnotes.txt bpo-46845: Reduce dict size when all keys are Unicode (GH-31564) 2022-03-02 08:09:28 +09:00
dictobject.c Revert "[3.11] GH-92678: Expose managed dict clear and visit functions (GH-95246). (#95256)" (#95647) 2022-08-04 13:03:07 +01:00
enumobject.c bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. (gh-30928) 2022-02-08 13:39:07 -07:00
exception_handling_notes.txt gh-96455: update example in exception_handling_notes.txt to the 3.11RC bytecode (GH-96456) 2022-09-01 06:45:09 -07:00
exceptions.c gh-95369: add missing decref in error case of exception group's split (GH-95370) 2022-07-28 04:28:46 -07:00
fileobject.c bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. (gh-30928) 2022-02-08 13:39:07 -07:00
floatobject.c gh-95605: Fix float(s) error message when s contains only whitespace (GH-95665) (GH-95858) 2022-08-11 17:16:53 +01:00
frame_layout.md GH-89480: Document motivation, design and implementation of 3.11 frame stack. (GH-32304) 2022-04-11 16:05:20 +01:00
frameobject.c [3.11] GH-94739: Backport GH-94958 to 3.11 (#94965) 2022-07-25 12:11:06 +01:00
funcobject.c Fix the closure argument to PyEval_EvalCodeEx. (GH-92175) 2022-05-02 14:08:22 -06:00
genericaliasobject.c gh-94607: Fix subclassing generics (GH-94610) 2022-07-08 22:20:43 -07:00
genobject.c Add more stats for freelist use and allocations. (GH-92211) 2022-05-03 16:40:24 -06:00
interpreteridobject.c bpo-35081: Move interpreteridobject.h to Include/internal/ (GH-28969) 2021-10-15 11:56:34 +02:00
iterobject.c bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. (gh-30928) 2022-02-08 13:39:07 -07:00
listobject.c gh-95173: Revert commit 51ed2c56a1 (GH-95176) 2022-07-24 15:01:47 -07:00
listsort.txt Fix typos in the Objects directory (GH-28766) 2021-10-06 16:57:10 -07:00
lnotab_notes.txt bpo-44525: Split calls into PRECALL and CALL (GH-30011) 2021-12-14 18:22:44 +00:00
locations.md GH-88116: Use a compact format to represent end line and column offsets. (GH-91666) 2022-04-21 16:10:37 +01:00
longobject.c [3.11] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96500) 2022-09-02 09:48:57 -07:00
memoryobject.c gh-92888: Fix memoryview bad __index__ use after free (GH-92946) 2022-06-18 07:40:39 -07:00
methodobject.c Use static inline function Py_EnterRecursiveCall() (#91988) 2022-05-04 13:30:23 +02:00
moduleobject.c no-issue: Add assertion to PyModule_GetName for understanding (GH-32236) 2022-04-02 09:56:30 +09:00
namespaceobject.c bpo-45482: Rename namespaceobject.h to pycore_namespace.h (GH-28975) 2021-10-15 15:21:21 +02:00
object.c GH-92678: Document that you shouldn't be doing your own dictionary offset calculations. (GH-95598) (GH-95821) 2022-08-09 16:22:54 +01:00
obmalloc.c gh-94841: Ensure arena_map_get() is inlined in PyObject_Free() (GH-94842) 2022-07-14 12:04:06 -07:00
odictobject.c gh-91320: Use _PyCFunction_CAST() (#92251) 2022-05-03 21:42:14 +02:00
picklebufobject.c gh-91118: Fix docstrings that do not honor --without-doc-strings (#31769) 2022-04-17 20:39:32 -07:00
rangeobject.c bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. (gh-30928) 2022-02-08 13:39:07 -07:00
README
setobject.c bpo-26579: Add object.__getstate__(). (GH-2821) 2022-04-06 20:00:14 +03:00
sliceobject.c gh-91731: Replace Py_BUILD_ASSERT() with static_assert() (#91730) 2022-04-20 19:26:40 +02:00
structseq.c bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. (gh-30928) 2022-02-08 13:39:07 -07:00
tupleobject.c Add more stats for freelist use and allocations. (GH-92211) 2022-05-03 16:40:24 -06:00
typeobject.c gh-96046: Initialize ht_cached_keys in PyType_Ready() (GH-96047) 2022-08-22 02:12:42 -07:00
typeslots.inc bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931) 2020-11-10 12:53:46 -08:00
typeslots.py bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931) 2020-11-10 12:53:46 -08:00
unicodectype.c bpo-46670: Remove unused macros in the Objects directory (GH-31193) 2022-02-07 16:21:41 +01:00
unicodeobject.c [3.11] bpo-40514: Drop EXPERIMENTAL_ISOLATED_SUBINTERPRETERS (gh-93185) (GH-93306) 2022-05-27 17:56:30 -07:00
unicodetype_db.h closes bpo-45190: Update Unicode data to version 14.0.0. (GH-28336) 2021-09-14 11:00:38 -07:00
unionobject.c gh-91603: Speed up isinstance/issubclass on union types (GH-91631) 2022-04-28 23:24:19 +08:00
weakrefobject.c [3.11] gh-95324: Emit a warning if an object doesn't call PyObject_GC_UnTrack during deallocation in debug mode (GH-95325) (#95336) 2022-07-27 16:55:44 +01:00

Source files for various builtin objects