Skip to content

Commit

Permalink
Guard against checking if EOF is an invalid character.
Browse files Browse the repository at this point in the history
Some encodings use a simple array lookup and EOF (-1) will always be an invalid index.
  • Loading branch information
nirvdrum committed Apr 6, 2015
1 parent c5b3e02 commit 2042347
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/lexer/yacc/RubyLexer.java
Expand Up @@ -1886,7 +1886,7 @@ private int identifier(int c, boolean commandState) throws IOException {
do {
if (!tokadd_mbchar(c)) return EOF;
c = nextc();
} while (isIdentifierChar(c));
} while (c != EOF && isIdentifierChar(c));

boolean lastBangOrPredicate = false;

Expand Down

1 comment on commit 2042347

@nirvdrum
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enebo Check this please. Adding this in fixed the Encoding#default_external specs using ShiftJS at start-up.

Please sign in to comment.