re-engine-RE2 icon indicating copy to clipboard operation
re-engine-RE2 copied to clipboard

Matching against some patterns does not terminate

Open telnet23 opened this issue 2 years ago • 0 comments

If the pattern is such that it should successfully match the empty string, then matching against the pattern in list context with the global modifier set does not terminate. For example:

my $s = "tood";
my $p = "a*";
my @m = $s =~ /$p/g;

In Perl, the above yields an array of $n + 1 empty strings, where $n is the length of $s. When using RE2, the above does not terminate and causes the machine to run out of memory.

telnet23 avatar Jun 19 '23 01:06 telnet23