summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-06-12 14:07:36 (GMT)
committerGitHub <noreply@github.com>2024-06-12 14:07:36 (GMT)
commite04809299fc1a5f0ff0b567173439cb0b6f8e907 (patch)
tree88ec3fa391e54989ea43dff0cccf7798d76939bf /Modules
parent91c4444d22a36119c83c9a21bfe0efe39d745086 (diff)
downloadcpython-e04809299fc1a5f0ff0b567173439cb0b6f8e907.zip
cpython-e04809299fc1a5f0ff0b567173439cb0b6f8e907.tar.gz
cpython-e04809299fc1a5f0ff0b567173439cb0b6f8e907.tar.bz2
[3.13] gh-120155: Add assertion to sre.c match_getindex() (GH-120402) (#120409)
gh-120155: Add assertion to sre.c match_getindex() (GH-120402) Add an assertion to help static analyzers to detect that i*2 cannot overflow. (cherry picked from commit 42b25dd61ff3593795c4cc2ffe876ab766098b24) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sre/sre.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_sre/sre.c b/Modules/_sre/sre.c
index e330340..0c656b4 100644
--- a/Modules/_sre/sre.c
+++ b/Modules/_sre/sre.c
@@ -2217,6 +2217,8 @@ match_getindex(MatchObject* self, PyObject* index)
return -1;
}
+ // Check that i*2 cannot overflow to make static analyzers happy
+ assert(i <= SRE_MAXGROUPS);
return i;
}