diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-12 14:07:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 14:07:36 (GMT) |
commit | e04809299fc1a5f0ff0b567173439cb0b6f8e907 (patch) | |
tree | 88ec3fa391e54989ea43dff0cccf7798d76939bf /Modules | |
parent | 91c4444d22a36119c83c9a21bfe0efe39d745086 (diff) | |
download | cpython-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.c | 2 |
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; } |