]> git.donarmstrong.com Git - lilypond.git/commitdiff
Avoid undefined behavior after "music expected" error
authorDavid Kastrup <dak@gnu.org>
Tue, 10 Sep 2013 09:34:02 +0000 (11:34 +0200)
committerDavid Kastrup <dak@gnu.org>
Sat, 26 Oct 2013 17:36:27 +0000 (19:36 +0200)
This problem was introduced in 2.17.4 by an oversight in issue 2862.

lily/parser.yy

index b54191d8390a1e6494efaef27a3b19506d6611d6..fcde23ac9d9835211b7f4e4f584dc95b84d5f652 100644 (file)
@@ -1063,7 +1063,10 @@ music_arg:
        {
                $$ = make_music_from_simple (parser, @1, $1);
                 if (!unsmob_music ($$))
+               {
                         parser->parser_error (@1, _ ("music expected"));
+                       $$ = MAKE_SYNTAX ("void-music", @$);
+               }
        }
        | composite_music %prec COMPOSITE
        ;
@@ -2472,7 +2475,10 @@ event_chord:
                                 unsmob_music ($$)->set_property ("articulations",
                                                                  scm_reverse_x ($2, SCM_EOL));
                         else
+                       {
                                 parser->parser_error (@1, _("music expected"));
+                               $$ = MAKE_SYNTAX ("void-music", @1);
+                       }
                }
        }
        | simple_chord_elements post_events     {