diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-05-11T10·02+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2018-05-11T10·05+0200 |
commit | 1ad19232c4bbecb06e6acbb2a3a538544a28e1f2 (patch) | |
tree | 52ee9c2745698691e031fd249c872f5e04e349f7 | |
parent | f3c85f9eb395b13790d1fced05665125e2ec81ca (diff) |
Don't return negative numbers from the flex tokenizer
Fixes #1374. Closes #2129.
-rw-r--r-- | src/libexpr/lexer.l | 6 | ||||
-rw-r--r-- | tests/lang/parse-fail-uft8.nix | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 8855d794ea98..29ca327c1e4e 100644 --- a/src/libexpr/lexer.l +++ b/src/libexpr/lexer.l @@ -209,7 +209,11 @@ or { return OR_KW; } \#[^\r\n]* /* single-line comments */ \/\*([^*]|\*+[^*/])*\*+\/ /* long comments */ -{ANY} return yytext[0]; +{ANY} { + /* Don't return a negative number, as this will cause + Bison to stop parsing without an error. */ + return (unsigned char) yytext[0]; + } } diff --git a/tests/lang/parse-fail-uft8.nix b/tests/lang/parse-fail-uft8.nix new file mode 100644 index 000000000000..34948d48aed2 --- /dev/null +++ b/tests/lang/parse-fail-uft8.nix @@ -0,0 +1 @@ +123 é 4 |