]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96499)
authorGregory P. Smith <gps@google.com>
Fri, 2 Sep 2022 16:35:08 +0000 (09:35 -0700)
committerGitHub <noreply@github.com>
Fri, 2 Sep 2022 16:35:08 +0000 (09:35 -0700)
commit511ca9452033ef95bc7d7fc404b8161068226002
treecefd49e0c9c75f912fa28d05eae15335273aaa8e
parent656167db81a53934da55d90ed431449d8a4fc14b
gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96499)

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.

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#). Much of that text wound up in the Issue. Backports PRs already exist. See the issue for links.
28 files changed:
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.12.rst
Include/internal/pycore_global_strings.h
Include/internal/pycore_initconfig.h
Include/internal/pycore_interp.h
Include/internal/pycore_long.h
Include/internal/pycore_runtime_init_generated.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