jpbro / VbPcre2

PCRE2 Wrapper for VB6
Other
14 stars 16 forks source link

Memory overflow with regular .* #16

Closed dragokas closed 7 years ago

dragokas commented 7 years ago

I found "infinite" loop in SubMatches method, when you are executing TestRegex2() with l_Regex = ".*$"

dragokas commented 7 years ago

Another different infinite loop:

l_SubjectText = "Wyzo" l_Regex = "(Manager)|^((copy of )?)"

jpbro commented 7 years ago

Hi @dragokas, thanks for these examples. Looks like the problem is with the Global loop and PCRE2 empty match behaviour (PCRE2 can return an empty match, but the loop doesn't detect this properly and ends up looping infinitely). I will have a fix soon.

jpbro commented 7 years ago

Just committed a partial solution for this problem. There should be no more infinite loop, but we're getting different results to VBScript CRegex when Multiline=True and there could be subsequent matches after an empty match. I'll need to work on a solution for this.

jpbro commented 7 years ago

Closing this issue since I think it is fixed re: the infinite loop.

I'm opening a new issue to discuss the PCRE2/VBScript discrepancy described above: https://github.com/jpbro/VbPcre2/issues/19