[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 42b25dd61f)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2024-06-12 16:07:36 +02:00 committed by GitHub
parent 91c4444d22
commit e04809299f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -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;
}