[Bug libstdc++/61601] C++11 regex resource exhaustion
timshen at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Oct 25 21:47:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61601
--- Comment #10 from Tim Shen <timshen at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #9)
> (In reply to Tim Shen from comment #7)
> > (In reply to Maksymilian Arciemowicz from comment #6)
> > > > Do you have any other testcases?
> > >
> > > for trunk? maybe you have to use ::regex_match
> >
> > std::regex_match("findme", std::regex("(.*{100}{200}findme)"));
> >
> > there's no memory problem, it just takes exponentially long time to run
> > (which is expected when using backtracking).
> >
> > To avoid it, you can use Thompson NFA:
> >
> > #define _GLIBCXX_REGEX_USE_THOMPSON_NFA
> > #include <regex>
> >
> > int main (int argc, char *argv[])
> > {
> > std::regex_match("findme", std::regex("(.*{100}{200}findme)",
> > std::regex_constants::extended));
> >
> > return 0;
> >
> > }
> >
> > Notice that for now Thompson NFA doesn't support ECMAScript.
>
> Are you still working on this?
No, I'm not actively working on this.
More information about the Gcc-bugs
mailing list