mirror of
https://github.com/python/cpython.git
synced 2026-02-13 19:04:37 +00:00
[3.14] gh-140979: Fix off-by-one error in the RE code validator (GH-140984) (GH-141001)
It was too lenient and allowed MARK opcodes with too large value.
(cherry picked from commit 1326d2a808)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
c3f9702f04
commit
267af29832
1 changed files with 1 additions and 1 deletions
|
|
@ -1942,7 +1942,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
|
|||
sre_match() code is robust even if they don't, and the worst
|
||||
you can get is nonsensical match results. */
|
||||
GET_ARG;
|
||||
if (arg > 2 * (size_t)groups + 1) {
|
||||
if (arg >= 2 * (size_t)groups) {
|
||||
VTRACE(("arg=%d, groups=%d\n", (int)arg, (int)groups));
|
||||
FAIL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue