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

[Bug] Impossible regular expression in macro lead to ArrayIndexOut [sf#104] #106

Closed
lsf37 opened this issue Feb 15, 2015 · 2 comments
Closed
Labels
bug Not working as intended
Milestone

Comments

@lsf37
Copy link
Member

lsf37 commented Feb 15, 2015

*Reported by anonymous on 2009-04-16 17:25 UTC
Hello,
one of the developer on my project has declared a new macro with an impossible regular expression:

ALPHA_NUMERIC = [a-Z0-9]

This one does not create any warning during Java code generation but:

Warning : Macro "ALPHA_NUMERIC" has been declared but never used.

However at runtime, it throws the following exception:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 65536
at TestCase.zzUnpackCMap
at TestCase.<clinit>
... 6 more

In fact the regular expression [a-Z] is impossible because of ASCII char order, the developer meant [A-z].

Please find attached a testcase TestCase.flex.

The following Main.java class can be used:

import java.io.ByteArrayInputStream;
import java.io.IOException;

public class Main {
public static void main(String[] args) throws IOException {
new TestCase(new ByteArrayInputStream("Hello\nWorld!".getBytes())).readMessage();
}
}

Regards,
Loïc

@lsf37 lsf37 changed the title Impossible regular expression in macro lead to ArrayIndexOut [Bug] Impossible regular expression in macro lead to ArrayIndexOut [sf#104] Feb 15, 2015
@lsf37 lsf37 added this to the jflex bug milestone Feb 15, 2015
@lsf37 lsf37 closed this as completed Feb 15, 2015
@lsf37
Copy link
Member Author

lsf37 commented Feb 15, 2015

Commented by nobody on 2009-04-16 17:25 UTC
Flex file

@lsf37
Copy link
Member Author

lsf37 commented Feb 15, 2015

Commented by nobody on 2009-04-30 12:12 UTC
Thanks for the report, I've reproduced the problem. It will be fixed for the next release.

Cheers,
Gerwin

@lsf37 lsf37 added bug Not working as intended and removed bug Not working as intended labels Feb 17, 2015
@lsf37 lsf37 modified the milestone: jflex bug Feb 17, 2015
@regisd regisd added this to the 1.5.0 milestone Nov 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants