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

StackOverflowError for regexp with unescaped "@" symbol. #21

Closed
RayzRazko opened this issue Mar 13, 2016 · 2 comments
Closed

StackOverflowError for regexp with unescaped "@" symbol. #21

RayzRazko opened this issue Mar 13, 2016 · 2 comments

Comments

@RayzRazko
Copy link

Got java.lang.StackOverflowError if I try to generate random string with regexp that contains unescaped "@" symbol:

Generex rnd = new Generex("[a-z]@mail.com"); 
System.out.println(rnd.random());
//specifying the boundaries doesn't help 
Generex rnd = new Generex("[a-z]@mail.com"); 
System.out.println(rnd.random(20, 50));

while next line is totally ok for Java Pattern:
Pattern.compile("[a-z]@mail.com").matcher("m@mail.com").matches()

Generex works fine with next patterns:"[a-z]\\@mail.com", "[a-z][@]mail.com".

Stack:

java.lang.StackOverflowError
    at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
    at java.util.TimSort.sort(TimSort.java:220)
    at java.util.Arrays.sort(Arrays.java:1438)
    at dk.brics.automaton.State.getSortedTransitionArray(Unknown Source)
    at dk.brics.automaton.State.getSortedTransitions(Unknown Source)
    at com.mifmif.common.regex.Generex.prepareRandom(Generex.java:282)
    at com.mifmif.common.regex.Generex.prepareRandom(Generex.java:303)
    at com.mifmif.common.regex.Generex.prepareRandom(Generex.java:303)
    at com.mifmif.common.regex.Generex.prepareRandom(Generex.java:303)
    at com.mifmif.common.regex.Generex.prepareRandom(Generex.java:303)
.....

@mifmif
Copy link
Owner

mifmif commented Mar 15, 2016

it seems that the @ is interpreted as a meta char , i will fix this issue.

@mifmif
Copy link
Owner

mifmif commented May 3, 2016

you can now use the feature discussed in issue #22 to avoid interpreting Metacharacter like @

@mifmif mifmif closed this as completed May 3, 2016
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