Skip to content

Commit b1e314a

Browse files
gh-95778: add doc missing in some places (GH-100627)
(cherry picked from commit 4652182) Co-authored-by: Éric <earaujo@caravan.coop>
1 parent 297465a commit b1e314a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Misc/python.man

+9
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ Set implementation-specific option. The following options are available:
358358
-X frozen_modules=[on|off]: whether or not frozen modules should be used.
359359
The default is "on" (or "off" if you are running a local build).
360360

361+
-X int_max_str_digits=number: limit the size of int<->str conversions.
362+
This helps avoid denial of service attacks when parsing untrusted data.
363+
The default is sys.int_info.default_max_str_digits. 0 disables.
364+
361365
.TP
362366
.B \-x
363367
Skip the first line of the source. This is intended for a DOS
@@ -531,6 +535,11 @@ values.
531535

532536
The integer must be a decimal number in the range [0,4294967295]. Specifying
533537
the value 0 will disable hash randomization.
538+
.IP PYTHONINTMAXSTRDIGITS
539+
Limit the maximum digit characters in an int value
540+
when converting from a string and when converting an int back to a str.
541+
A value of 0 disables the limit. Conversions to or from bases 2, 4, 8,
542+
16, and 32 are never limited.
534543
.IP PYTHONMALLOC
535544
Set the Python memory allocators and/or install debug hooks. The available
536545
memory allocators are

Python/initconfig.c

+2
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ static const char usage_envvars[] =
168168
"PYTHONDEBUG : enable parser debug mode (-d)\n"
169169
"PYTHONDONTWRITEBYTECODE : don't write .pyc files (-B)\n"
170170
"PYTHONINSPECT : inspect interactively after running script (-i)\n"
171+
"PYTHONINTMAXSTRDIGITS : limit max digit characters in an int value\n"
172+
" (-X int_max_str_digits=number)\n"
171173
"PYTHONNOUSERSITE : disable user site directory (-s)\n"
172174
"PYTHONOPTIMIZE : enable level 1 optimizations (-O)\n"
173175
"PYTHONUNBUFFERED : disable stdout/stderr buffering (-u)\n"

0 commit comments

Comments
 (0)