parseaut: fix handling of [ outside HOA

Fixes #509.

* spot/parseaut/scanaut.ll: Reset ->str whenever a [ is read,
so that we do not attempt to clear ->str while reading garbage.
* NEWS: Mention the bug.
* tests/core/parseaut.test: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2022-06-23 17:19:09 +02:00
parent b4279d3a12
commit 9222e9713b
3 changed files with 19 additions and 0 deletions

4
NEWS
View file

@ -124,6 +124,10 @@ New in spot 2.10.6.dev (not yet released)
hide true state could produce some incorrect GraphViz output if hide true state could produce some incorrect GraphViz output if
the automaton as a true state as part of a universal group. the automaton as a true state as part of a universal group.
- Due to an optimization introduces in 2.10 to parse HOA label more
efficiently, the automaton parser could crash when parsing random
input (not HOA) containing '[' (issue #509).
New in spot 2.10.6 (2022-05-18) New in spot 2.10.6 (2022-05-18)
Bugs fixed: Bugs fixed:

View file

@ -454,6 +454,11 @@ identifier [[:alpha:]_][[:alnum:]_.-]*
} }
} }
"[" {
yylval->str = nullptr;
return *yytext;
}
. return *yytext; . return *yytext;
%{ %{

View file

@ -2961,3 +2961,13 @@ EOF
# At some point, this crashed with # At some point, this crashed with
# input buffer overflow, can't enlarge buffer because scanner uses REJECT # input buffer overflow, can't enlarge buffer because scanner uses REJECT
run 0 autfilt -q bigaut run 0 autfilt -q bigaut
# This issued to segfault, because the parser assumed a '[' token was
# always attached to a string, while that was only true in HOA mode.
cat >input <<EOF
"foo" [t] --END--
EOF
autfilt -q input && exit 1
test $? -eq 2
: