Skip to content

Commit 2042347

Browse files
committed
Guard against checking if EOF is an invalid character.
Some encodings use a simple array lookup and EOF (-1) will always be an invalid index.
1 parent c5b3e02 commit 2042347

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/main/java/org/jruby/lexer/yacc/RubyLexer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ private int identifier(int c, boolean commandState) throws IOException {
18861886
do {
18871887
if (!tokadd_mbchar(c)) return EOF;
18881888
c = nextc();
1889-
} while (isIdentifierChar(c));
1889+
} while (c != EOF && isIdentifierChar(c));
18901890

18911891
boolean lastBangOrPredicate = false;
18921892

0 commit comments

Comments
 (0)