[gnome-builder] xml-pack: fix endless loop in parser



commit 0a78587abc636f802c29ca06b8ffa8944be2d9d8
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Sat Aug 5 00:59:27 2017 +0200

    xml-pack: fix endless loop in parser
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785843

 plugins/xml-pack/ide-xml-service.c |    5 ++++-
 plugins/xml-pack/ide-xml-utils.c   |    8 +++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-service.c b/plugins/xml-pack/ide-xml-service.c
index da4e857..3ff624c 100644
--- a/plugins/xml-pack/ide-xml-service.c
+++ b/plugins/xml-pack/ide-xml-service.c
@@ -695,7 +695,10 @@ get_detail (IdeXmlSymbolNode  *node,
 
   if (*cursor == 0)
     {
-      if (!g_unichar_isspace (next_ch) && next_ch != '<' && next_ch != '>')
+      if (!g_unichar_isspace (next_ch) &&
+          next_ch != '<' &&
+          next_ch != '>' &&
+          next_ch != '/')
         return IDE_XML_POSITION_DETAIL_NONE;
       else
         {
diff --git a/plugins/xml-pack/ide-xml-utils.c b/plugins/xml-pack/ide-xml-utils.c
index 5ab8e03..fea899a 100644
--- a/plugins/xml-pack/ide-xml-utils.c
+++ b/plugins/xml-pack/ide-xml-utils.c
@@ -185,7 +185,13 @@ ide_xml_utils_skip_attribute_name (const gchar **cursor)
     return TRUE;
 
   if (!is_name_start_char (ch))
-    return (g_unichar_isspace (ch));
+    {
+      if (g_unichar_isspace (ch))
+        return TRUE;
+
+      *cursor = g_utf8_next_char (*cursor);
+      return FALSE;
+    }
 
   p = g_utf8_next_char (p);
   while ((ch = g_utf8_get_char (p)))


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