diff options
author | Victor Stinner <vstinner@python.org> | 2024-06-12 13:27:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 13:27:07 (GMT) |
commit | 42b25dd61ff3593795c4cc2ffe876ab766098b24 (patch) | |
tree | 8df0d71acd7cabcfe9b386119f0307194f6d4db9 /Modules | |
parent | 4b1e85bafc5bcb8cb70bb17164e07aebf7ad7e8e (diff) | |
download | cpython-42b25dd61ff3593795c4cc2ffe876ab766098b24.zip cpython-42b25dd61ff3593795c4cc2ffe876ab766098b24.tar.gz cpython-42b25dd61ff3593795c4cc2ffe876ab766098b24.tar.bz2 |
gh-120155: Add assertion to sre.c match_getindex() (#120402)
Add an assertion to help static analyzers to detect that i*2 cannot
overflow.
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; } |