diff --git a/nixd/lib/Parser/Lexer.l b/nixd/lib/Parser/Lexer.l index 1f9b70d64..c52f259a6 100644 --- a/nixd/lib/Parser/Lexer.l +++ b/nixd/lib/Parser/Lexer.l @@ -66,16 +66,19 @@ or { return OR_KW; } .msg = hintfmt("invalid integer '%1%'", yytext), .errPos = data->state.positions[CUR_POS], }); + yyterminate(); } return INT; } {FLOAT} { errno = 0; yylval->nf = strtod(yytext, 0); - if (errno != 0) + if (errno != 0) { data->error.emplace_back(nix::ErrorInfo{ .msg = hintfmt("invalid float '%1%'", yytext), .errPos = data->state.positions[CUR_POS], }); + yyterminate(); + } return FLOAT; } @@ -205,6 +208,7 @@ or { return OR_KW; } .msg = hintfmt("path has a trailing slash"), .errPos = data->state.positions[CUR_POS], }); + yyterminate(); } {SPATH} { yylval->path = {yytext, (size_t) yyleng}; return SPATH; } diff --git a/nixd/tools/nixd-ast-dump/test/issue-231.nix b/nixd/tools/nixd-ast-dump/test/issue-231.nix new file mode 100644 index 000000000..450a419a4 --- /dev/null +++ b/nixd/tools/nixd-ast-dump/test/issue-231.nix @@ -0,0 +1,3 @@ +# RUN: valgrind --leak-check=full --error-exitcode=1 nixd-ast-dump %s + +/././