diff --git a/Changes b/Changes index 7b4fc165c..2f0c32823 100644 --- a/Changes +++ b/Changes @@ -22,6 +22,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Fix ugly error on interface misuse, bug1525. [Bogdan Vukobratovic] +**** Fix misc bad-syntax crashes, bug1532. [Eric Rippey] + * Verilator 4.018 2019-08-29 diff --git a/src/verilog.l b/src/verilog.l index 3b9cb009e..252c9550b 100644 --- a/src/verilog.l +++ b/src/verilog.l @@ -850,7 +850,8 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} /************************************************************************/ /* STRINGS */ -<> { FL_FWD; yyerrorf("EOF in unterminated string"); yyleng = 0; yy_pop_state(); FL_BRK; } +<> { FL_FWD; yyerrorf("EOF in unterminated string"); + yyleng = 0; yy_pop_state(); FL_BRK; yyterminate(); } {crnl} { FL_FWD; yyerrorf("Unterminated string"); FL_BRK; } \\{crnl} { yymore(); } \\. { yymore(); } @@ -867,7 +868,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} {word} { yymore(); } . { yymore(); } <> { FL_FWD; yyerrorf("EOF in (*"); - yyleng = 0; yy_pop_state(); FL_BRK; } + yyleng = 0; yy_pop_state(); FL_BRK; yyterminate(); } /************************************************************************/ /* Attributes */ @@ -883,7 +884,8 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} ";" { FL; yylval.strp = PARSEP->newString(yytext, yyleng); return yaTABLELINE; }
"endtable" { yy_pop_state(); FL; return yENDTABLE; }
. { yymore(); } -
<> { FL_FWD; yyerrorf("EOF in TABLE"); yyleng = 0; yy_pop_state(); FL_BRK; } +
<> { FL_FWD; yyerrorf("EOF in TABLE"); + yyleng = 0; yy_pop_state(); FL_BRK; yyterminate(); } /************************************************************************/ /* Preprocessor */ diff --git a/test_regress/t/t_fuzz_eof_bad.pl b/test_regress/t/t_fuzz_eof_bad.pl new file mode 100755 index 000000000..fd7324fbf --- /dev/null +++ b/test_regress/t/t_fuzz_eof_bad.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +scenarios(linter => 1); + +lint( + fails => 1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_fuzz_eof_bad.v b/test_regress/t/t_fuzz_eof_bad.v new file mode 100644 index 000000000..e82e286da --- /dev/null +++ b/test_regress/t/t_fuzz_eof_bad.v @@ -0,0 +1,3 @@ +module a; + initial $lay(*Hello!=n"); +endmodule