[gtk/builder-tool-fixes: 1/2] buildertool: Fix a possible crash




commit 5222dc0cd13663d6134d04ca4547680b2d282cc2
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Dec 13 13:52:50 2021 -0500

    buildertool: Fix a possible crash
    
    We need to call g_markup_parse_context_end_parse
    to catch incomplete documents that we might not
    handle well later.

 tools/gtk-builder-tool-simplify.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/tools/gtk-builder-tool-simplify.c b/tools/gtk-builder-tool-simplify.c
index dfa4eb7097..404a38b2d7 100644
--- a/tools/gtk-builder-tool-simplify.c
+++ b/tools/gtk-builder-tool-simplify.c
@@ -2295,6 +2295,12 @@ simplify_file (const char *filename,
       return FALSE;
     }
 
+  if (!g_markup_parse_context_end_parse (context, &error))
+    {
+      g_printerr (_("Can't parse ā€œ%sā€: %s\n"), filename, error->message);
+      return FALSE;
+    }
+
   data.builder = gtk_builder_new ();
 
   if (data.convert3to4)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]