Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns with very large minoccurs crash #11

Open
DrRataplan opened this issue Dec 20, 2019 · 2 comments
Open

Patterns with very large minoccurs crash #11

DrRataplan opened this issue Dec 20, 2019 · 2 comments

Comments

@DrRataplan
Copy link
Contributor

The following test from the QT3 test set that FontoXPath uses causes a crash:

 <test-case name="cbcl-matches-038">
      <description> test a large exact quantifier </description>
      <created by="Tim Mills" on="2008-07-17"/>      
      <test>fn:matches('aaa', 'a{2147483647}')</test>
      <result>
         <assert-false/>
      </result>
   </test-case>

It runs out of memory when compiling the huge program for the a{2147483647} pattern. We could try to detect these patalogically large minoccurs, compile the as if they were a+ and go over the whynot traces to see whether our minOccurs matches?

@devatwork
Copy link

devatwork commented Jan 8, 2020

Another common optimization is to compute the minimum length of any valid input, e.g. 2147483647 in the provided example, during parse. If the length of the input, aaa is less than the minimum required input there is no way it can match so we shouldn't even attempt to do so.

@devatwork
Copy link

See dotnet/runtime#1349 and dotnet/runtime#1348 for some recent optimizations made to the .NET Regex engine. Most of them are irrelevant but there may be some insight in those issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants