Skip to content

StackOverflowError from pattern input #56

@spacether

Description

@spacether

Thank you so much for making this tool!
When testing it, I ran into this case that causes a stack overflow:

String pattern = "^[a-zA-Z\s]*$";
Generex generex = new Generex(pattern);
String firstMatch = generex.getFirstMatch();

And when that code is run I get this exception:

Exception in thread "main" java.lang.StackOverflowError
	at java.base/java.util.HashMap$HashIterator.<init>(HashMap.java:1475)
	at java.base/java.util.HashMap$KeyIterator.<init>(HashMap.java:1514)
	at java.base/java.util.HashMap$KeySet.iterator(HashMap.java:912)
	at java.base/java.util.HashSet.iterator(HashSet.java:173)
	at java.base/java.util.AbstractCollection.toArray(AbstractCollection.java:184)
	at dk.brics.automaton.State.getSortedTransitionArray(Unknown Source)
	at dk.brics.automaton.State.getSortedTransitions(Unknown Source)
	at com.mifmif.common.regex.Generex.prepareTransactionNodes(Generex.java:265)

Could this be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions