[Python-checkins] gh-95778: add doc missing in some places (GH-100627)
miss-islington
webhook-mailer at python.org
Fri Dec 30 16:51:11 EST 2022
https://github.com/python/cpython/commit/b1e314ab9f8c3a2b53c7179674811f9c79328ce7
commit: b1e314ab9f8c3a2b53c7179674811f9c79328ce7
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022年12月30日T13:51:06-08:00
summary:
gh-95778: add doc missing in some places (GH-100627)
(cherry picked from commit 46521826cb1883e29e4640f94089dd92c57efc5b)
Co-authored-by: Éric <earaujo at caravan.coop>
files:
M Misc/python.man
M Python/initconfig.c
diff --git a/Misc/python.man b/Misc/python.man
index c979f5dff3ca..07a08315d8f3 100644
--- a/Misc/python.man
+++ b/Misc/python.man
@@ -358,6 +358,10 @@ Set implementation-specific option. The following options are available:
-X frozen_modules=[on|off]: whether or not frozen modules should be used.
The default is "on" (or "off" if you are running a local build).
+ -X int_max_str_digits=number: limit the size of int<->str conversions.
+ This helps avoid denial of service attacks when parsing untrusted data.
+ The default is sys.int_info.default_max_str_digits. 0 disables.
+
.TP
.B \-x
Skip the first line of the source. This is intended for a DOS
@@ -531,6 +535,11 @@ values.
The integer must be a decimal number in the range [0,4294967295]. Specifying
the value 0 will disable hash randomization.
+.IP PYTHONINTMAXSTRDIGITS
+Limit the maximum digit characters in an int value
+when converting from a string and when converting an int back to a str.
+A value of 0 disables the limit. Conversions to or from bases 2, 4, 8,
+16, and 32 are never limited.
.IP PYTHONMALLOC
Set the Python memory allocators and/or install debug hooks. The available
memory allocators are
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 0ccca265314d..d81cbaff7ec9 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -168,6 +168,8 @@ static const char usage_envvars[] =
"PYTHONDEBUG : enable parser debug mode (-d)\n"
"PYTHONDONTWRITEBYTECODE : don't write .pyc files (-B)\n"
"PYTHONINSPECT : inspect interactively after running script (-i)\n"
+"PYTHONINTMAXSTRDIGITS : limit max digit characters in an int value\n"
+" (-X int_max_str_digits=number)\n"
"PYTHONNOUSERSITE : disable user site directory (-s)\n"
"PYTHONOPTIMIZE : enable level 1 optimizations (-O)\n"
"PYTHONUNBUFFERED : disable stdout/stderr buffering (-u)\n"
More information about the Python-checkins
mailing list