From d34cf536aa10d5534767c140544b28d6f720abf0 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 9 Nov 2016 18:22:25 +0100 Subject: [PATCH] Fix ending the dynamic extent in Text_interface::interpret_markup When using cyclic references under guile-2.0 lilypond crashes with a segmentation fault: $ LANG=C out/bin/lilypond input/regression/markup-cyclic-reference.ly GNU LilyPond 2.19.51 Processing `input/regression/markup-cyclic-reference.ly' Parsing... Finding the ideal number of pages... Fitting music on 1 page... Drawing systems... Layout output to `/tmp/lilypond-wkUlSF'... Converting to `markup-cyclic-reference.pdf'... Deleting `/tmp/lilypond-wkUlSF'... Segmentation fault This happens because in Text_interface::interpret_markup the dynamic extent is not ended properly in the exit path for the case when the markup depth exceeds the max_depth. --- input/regression/markup-cyclic-reference.ly | 2 +- lily/text-interface.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/input/regression/markup-cyclic-reference.ly b/input/regression/markup-cyclic-reference.ly index 82bfe0641d..c0a952e3ea 100644 --- a/input/regression/markup-cyclic-reference.ly +++ b/input/regression/markup-cyclic-reference.ly @@ -1,7 +1,7 @@ \version "2.19.13" #(ly:set-option 'warning-as-error #f) #(ly:expect-warning (ly:translate-cpp-warning-scheme "Markup depth exceeds maximal value of %d; Markup: %s") 1024 'cycle-markup) -#(ly:expect-warning (ly:translate-cpp-warning-scheme "Markup depth exceeds maximal value of %d; Markup: %s") 1024 'cycleI-markup) +#(ly:expect-warning (ly:translate-cpp-warning-scheme "Markup depth exceeds maximal value of %d; Markup: %s") 1024 'cycleII-markup) \header { texidoc = "Cyclic markup definitions should cause a warning, but diff --git a/lily/text-interface.cc b/lily/text-interface.cc index 4598246163..d930cdaa37 100644 --- a/lily/text-interface.cc +++ b/lily/text-interface.cc @@ -134,6 +134,7 @@ Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup) scm_dynwind_unwind_handler (markup_down_depth, 0, SCM_F_WIND_EXPLICITLY); if (markup_depth > max_depth) { + scm_dynwind_end (); string name = ly_symbol2string (scm_procedure_name (func)); // TODO: Also print the arguments of the markup! non_fatal_error (_f ("Markup depth exceeds maximal value of %d; " -- 2.39.2