cpython/Objects
Gregory P. Smith 8f0fa4bd10
[3.10] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96501)
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:51:49 -07:00
..
clinic Fix bad grammar and import docstring for split/rsplit (GH-32381) (GH-32416) 2022-04-08 12:06:19 -05:00
stringlib [3.10] bpo-43504: Remove effbot urls (GH-26308) (#92161) 2022-05-02 12:21:51 -06:00
abstract.c bpo-30570: Use Py_EnterRecursiveCall() in issubclass() (GH-29048) 2021-10-22 14:46:56 -07: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 bpo-41870: Avoid the test when nargs=0 (GH-22462) 2020-10-01 13:50:40 +09:00
bytearrayobject.c GH-91153: Handle mutating __index__ methods in bytearray item assignment (GH-94891) 2022-07-19 10:04:47 -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 bpo-42128: Structural Pattern Matching (PEP 634) (GH-22917) 2021-02-26 14:51:55 -08:00
call.c bpo-42990: Further refactoring of PyEval_ functions. (GH-24368) 2021-02-01 10:42:03 +00:00
capsule.c bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587) 2020-12-01 10:37:39 +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-44657: Fix instancemethod_call to use PyInstanceMethod_GET_FUNCTION (GH-27202) 2021-07-28 06:29:17 -07:00
codeobject.c [3.10] GH-96187: Prevent _PyCode_GetExtra to return garbage for negative indexes (GH-96188). (#96210) 2022-08-23 15:58:25 +01:00
complexobject.c bpo-44698: Restore complex pow behaviour for small integral exponents (GH-27772) (GH-27796) 2021-08-17 18:38:03 +01:00
descrobject.c bpo-43721: Fix docstrings for property.getter/setter/deleter (GH-31046) 2022-03-14 16:51:55 -07:00
dict-common.h bpo-33312: Fix clang ubsan out of bounds warnings in dict. (GH-6537) 2018-04-19 22:41:19 -07:00
dictnotes.txt Issue #15055: update dictnotes.txt. Patch by Mark Shannon. 2012-06-24 21:03:45 +02:00
dictobject.c bpo-44114: Remove redundant cast. (GH-26098) 2021-05-13 14:07:31 -07:00
enumobject.c bpo-42536: GC track recycled tuples (GH-23623) 2020-12-04 19:45:57 -08:00
exceptions.c bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179) 2022-03-30 18:48:31 -07:00
fileobject.c bpo-43916: PyStdPrinter_Type uses Py_TPFLAGS_DISALLOW_INSTANTIATION (GH-25749) 2021-04-30 14:56:27 +02:00
floatobject.c gh-95605: Fix float(s) error message when s contains only whitespace (GH-95665) (GH-95859) 2022-08-10 19:57:55 +01:00
frameobject.c [3.10] gh-92311: Let frame_setlineno jump over listcomps (GH-92717) 2022-05-12 16:31:43 +01:00
funcobject.c bpo-46236: Fix PyFunction_GetAnnotations() returned tuple. (GH-30409) 2022-01-05 05:12:21 -08:00
genericaliasobject.c [3.10] gh-91118: Fix docstrings that do not honor --without-doc-strings (GH-31769) (#91662) 2022-04-19 13:01:09 -07:00
genobject.c [3.10] GH--93592: Fix frame chain when throwing exceptions into coroutines (GH-95207) 2022-08-23 12:23:39 +01:00
interpreteridobject.c bpo-43962: Fix _PyInterpreterState_IDIncref() (GH-25683) 2021-04-28 13:40:44 +02:00
iterobject.c bpo-44963: Implement send() and throw() methods for anext_awaitable objects (GH-27955) 2021-09-07 03:52:53 -07:00
listobject.c gh-92914: Round the allocated size for lists up to the even number (GH-92915) (GH-92942) 2022-06-07 10:54:40 +02:00
listsort.txt [3.10] Fix typos in the Objects directory (GH-28766) (GH-28797) 2021-10-07 07:31:33 -07:00
lnotab_notes.txt bpo-42739: Don't use sentinels to mark end of line table. (GH-25657) 2021-04-29 13:12:51 +01:00
longobject.c [3.10] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96501) 2022-09-02 09:51:49 -07:00
memoryobject.c gh-92888: Fix memoryview bad __index__ use after free (GH-92946) (GH-93950) 2022-06-23 18:10:14 +08:00
methodobject.c bpo-33930: Fix segfault with deep recursion when cleaning method objects (GH-27678) (GH-27719) 2021-08-11 10:32:44 +02:00
moduleobject.c bpo-43901: Fix refleaks in test_module (GH-25754) 2021-04-30 17:26:45 +01:00
namespaceobject.c bpo-39075: types.SimpleNamespace no longer sorts attributes in its repr (GH-19430) 2020-05-15 18:27:54 -07:00
object.c [3.10] bpo-46940: Don't override existing AttributeError suggestion information (GH-31710) (GH-31724) 2022-03-07 13:18:36 +00:00
obmalloc.c [3.10] gh-94841: Ensure arena_map_get() is inlined in PyObject_Free() (GH-94842) 2022-07-14 17:26:40 -07:00
odictobject.c bpo-46085: Fix iterator cache mechanism of OrderedDict. (GH-30290) 2021-12-29 21:29:03 -08:00
picklebufobject.c [3.10] gh-91118: Fix docstrings that do not honor --without-doc-strings (GH-31769) (#91662) 2022-04-19 13:01:09 -07:00
rangeobject.c bpo-45030: Fix integer overflow in __reduce__ of the range iterator (GH-28000) 2021-09-04 13:39:30 -07:00
README Issue #18093: Factor out the programs that embed the runtime 2014-07-25 21:52:14 +10:00
setobject.c bpo-46615: Don't crash when set operations mutate the sets (GH-31120) 2022-02-11 12:44:17 -08:00
sliceobject.c bpo-43268: Pass interp rather than tstate to internal functions (GH-24580) 2021-02-19 15:10:45 +01:00
structseq.c bpo-43916: Move the _PyStructSequence_InitType function to the internal API (GH-25854) 2021-05-03 15:50:24 +01:00
tupleobject.c bpo-43977: Use tp_flags for collection matching (GH-25723) 2021-04-30 09:50:28 +01:00
typeobject.c gh-93021: Fix __text_signature__ for __get__ (GH-93023) (GH-94086) 2022-06-21 22:32:24 +02: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 Removed unintentional trailing spaces in non-external and non-generated C files. 2015-03-18 21:53:15 +02:00
unicodeobject.c bpo-36819: Fix crashes in built-in encoders with weird error handlers (GH-28593) 2022-05-02 02:58:41 -07:00
unicodetype_db.h closes bpo-39926: Update Unicode to 13.0.0. (GH-18910) 2020-03-10 20:41:34 -07:00
unionobject.c [3.10] gh-91118: Fix docstrings that do not honor --without-doc-strings (GH-31769) (#91662) 2022-04-19 13:01:09 -07:00
weakrefobject.c [3.10] gh-79512: Fixed names and __module__ value of weakref classes (GH-93719) (GH-94071) 2022-06-21 22:36:09 +03:00

Source files for various builtin objects