#104 Impossible regular expression in macro lead to ArrayIndexOut

jflex bug
closed-fixed
3
2014-03-01
2009-04-16
Anonymous
No

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

Discussion

  • Nobody/Anonymous

    Flex file

     
  • Nobody/Anonymous

    Thanks for the report, I've reproduced the problem. It will be fixed for the next release.

    Cheers,
    Gerwin

     
  • Gerwin Klein

    Gerwin Klein - 2009-04-30
    • priority: 5 --> 3
     
  • Steve Rowe

    Steve Rowe - 2013-12-23

    I committed a fix in r730.

     
  • Gerwin Klein

    Gerwin Klein - 2014-01-16
    • status: open --> open-fixed
     
  • Gerwin Klein

    Gerwin Klein - 2014-03-01
    • status: open-fixed --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks