aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libexpr/lexer.l6
-rw-r--r--tests/lang/parse-fail-uft8.nix1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index 8855d794e..29ca327c1 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 000000000..34948d48a
--- /dev/null
+++ b/tests/lang/parse-fail-uft8.nix
@@ -0,0 +1 @@
+123 é 4