diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y index 0fd663a..0dafedd 100644 --- a/src/xkbcomp/parser.y +++ b/src/xkbcomp/parser.y @@ -465,7 +465,6 @@ SymbolsBody : SymbolsBody COMMA SymbolsVarDecl { $$.head = $1.head; $$.last->common.next = &$3->common; $$.last = $3; } | SymbolsVarDecl { $$.head = $$.last = $1; } - | { $$.head = $$.last = NULL; } ; SymbolsVarDecl : Lhs EQUALS Expr { $$ = VarCreate($1, $3); } diff --git a/test/data/keymaps/empty-symbol-decl.xkb b/test/data/keymaps/empty-symbol-decl.xkb new file mode 100644 index 0000000..06e5b0c --- /dev/null +++ b/test/data/keymaps/empty-symbol-decl.xkb @@ -0,0 +1,10 @@ +xkb_keymap { + xkb_keycodes { include "evdev+aliases(qwerty)" }; + xkb_types { include "complete" }; + xkb_compat { include "complete" }; + xkb_symbols "sym" { + // This syntax caused the crash in parser before, and is not accepted + // anymore. + key { , [Space] }; + }; +}; diff --git a/test/filecomp.c b/test/filecomp.c index e73dc4c..116ffe8 100644 --- a/test/filecomp.c +++ b/test/filecomp.c @@ -54,6 +54,7 @@ main(void) assert(!test_file(ctx, "keymaps/bad.xkb")); assert(!test_file(ctx, "keymaps/syntax-error.xkb")); assert(!test_file(ctx, "keymaps/syntax-error2.xkb")); + assert(!test_file(ctx, "keymaps/empty-symbol-decl.xkb")); assert(!test_file(ctx, "does not exist")); /* Test response to invalid flags and formats. */