]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.10] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96501)
authorGregory P. Smith <gps@google.com>
Fri, 2 Sep 2022 16:51:49 +0000 (09:51 -0700)
committerGitHub <noreply@github.com>
Fri, 2 Sep 2022 16:51:49 +0000 (09:51 -0700)
commit8f0fa4bd10aba723aff988720cd26b93be99bc12
tree533e993997f3f0135df42dfca9796996361ca504
parentbbcb03e7b07ecf6f3ed0c308f72bc10f928c85a8
[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 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.10.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.10.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