gh-140979: Fix off-by-one error in the RE code validator (GH-140984)
It was too lenient and allowed MARK opcodes with too large value.
This commit is contained in:
@@ -1946,7 +1946,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user