jscript: Handle star and opt operators while matching global regex properly.

Before this fix, the regex engine would run into an infinite loop and OOM when encountering a
quantifier allowing a zero amount of items in a REG_GLOB regex.
This commit is contained in:
Charlotte Pabst 2024-11-19 00:01:19 +01:00 committed by Alexandre Julliard
parent 721b7f5df6
commit 1365b27a6b
Notes: Alexandre Julliard 2024-11-19 23:23:45 +01:00
Approved-by: Jacek Caban (@jacek)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6840

View file

@ -208,6 +208,9 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr,
ret[i].index = result->cp - str - result->match_len;
ret[i++].length = result->match_len;
if (result->match_len == 0)
result->cp++;
if(!gflag && !(This->jsregexp->flags & REG_GLOB)) {
hres = S_OK;
break;