]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96500)
authorGregory P. Smith <gps@google.com>
Fri, 2 Sep 2022 16:48:57 +0000 (09:48 -0700)
committerGitHub <noreply@github.com>
Fri, 2 Sep 2022 16:48:57 +0000 (09:48 -0700)
commitf8b71da9aac6ea74808dcdd0cc266e705431356b
tree15c907ee17d4bea98c66181406b646e2114f68ff
parent57116d56822fd9dee841a4560d73c650d15735d4
[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 511ca9452033ef95bc7d7fc404b8161068226002

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#).
27 files changed:
Doc/data/python3.11.abi
Doc/library/functions.rst
Doc/library/json.rst
Doc/library/stdtypes.rst
Doc/library/sys.rst
Doc/library/test.rst
Doc/using/cmdline.rst
Doc/whatsnew/3.11.rst
Include/internal/pycore_initconfig.h
Include/internal/pycore_interp.h
Include/internal/pycore_long.h
Lib/idlelib/idle_test/test_sidebar.py
Lib/test/support/__init__.py
Lib/test/test_ast.py
Lib/test/test_cmd_line.py
Lib/test/test_compile.py
Lib/test/test_decimal.py
Lib/test/test_int.py
Lib/test/test_json/test_decode.py
Lib/test/test_sys.py
Lib/test/test_xmlrpc.py
Misc/NEWS.d/next/Security/2022-08-07-16-53-38.gh-issue-95778.ch010gps.rst [new file with mode: 0644]
Objects/longobject.c
Parser/pegen.c
Python/clinic/sysmodule.c.h
Python/initconfig.c
Python/sysmodule.c