Report unfinished entity references as errors rather than running into an
authorMatthias Clasen <matthiasc@src.gnome.org>
Tue, 7 May 2002 21:45:21 +0000 (21:45 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 7 May 2002 21:45:21 +0000 (21:45 +0000)
* glib/gmarkup.c (unescape_text): Report unfinished entity
references as errors rather than running into an assert.  (#80441)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gmarkup.c

index e500835..b8afb0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gmarkup.c (unescape_text): Report unfinished entity
+       references as errors rather than running into an assert.  (#80441)
+
 2002-05-07  Michael Natterer  <mitch@gimp.org>
 
        * configure.in: added a new conditional CROSS_COMPILING which
index e500835..b8afb0c 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gmarkup.c (unescape_text): Report unfinished entity
+       references as errors rather than running into an assert.  (#80441)
+
 2002-05-07  Michael Natterer  <mitch@gimp.org>
 
        * configure.in: added a new conditional CROSS_COMPILING which
index e500835..b8afb0c 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gmarkup.c (unescape_text): Report unfinished entity
+       references as errors rather than running into an assert.  (#80441)
+
 2002-05-07  Michael Natterer  <mitch@gimp.org>
 
        * configure.in: added a new conditional CROSS_COMPILING which
index e500835..b8afb0c 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gmarkup.c (unescape_text): Report unfinished entity
+       references as errors rather than running into an assert.  (#80441)
+
 2002-05-07  Michael Natterer  <mitch@gimp.org>
 
        * configure.in: added a new conditional CROSS_COMPILING which
index e500835..b8afb0c 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gmarkup.c (unescape_text): Report unfinished entity
+       references as errors rather than running into an assert.  (#80441)
+
 2002-05-07  Michael Natterer  <mitch@gimp.org>
 
        * configure.in: added a new conditional CROSS_COMPILING which
index e500835..b8afb0c 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gmarkup.c (unescape_text): Report unfinished entity
+       references as errors rather than running into an assert.  (#80441)
+
 2002-05-07  Michael Natterer  <mitch@gimp.org>
 
        * configure.in: added a new conditional CROSS_COMPILING which
index e500835..b8afb0c 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gmarkup.c (unescape_text): Report unfinished entity
+       references as errors rather than running into an assert.  (#80441)
+
 2002-05-07  Michael Natterer  <mitch@gimp.org>
 
        * configure.in: added a new conditional CROSS_COMPILING which
index 39ff57b..8f5c6b8 100644 (file)
@@ -592,9 +592,27 @@ unescape_text (GMarkupParseContext *context,
         }
     }
 
-  /* If no errors, we should have returned to USTATE_INSIDE_TEXT */
-  g_assert (context->state == STATE_ERROR ||
-            state == USTATE_INSIDE_TEXT);
+  if (context->state != STATE_ERROR) 
+    {
+      switch (state) 
+       {
+       case USTATE_INSIDE_TEXT:
+         break;
+       case USTATE_AFTER_AMPERSAND:
+       case USTATE_INSIDE_ENTITY_NAME:
+         set_unescape_error (context, error,
+                             NULL, NULL,
+                             G_MARKUP_ERROR_PARSE,
+                             _("Unfinished entity reference"));
+         break;
+       case USTATE_AFTER_CHARREF_HASH:
+         set_unescape_error (context, error,
+                             NULL, NULL,
+                             G_MARKUP_ERROR_PARSE,
+                             _("Unfinished character reference"));
+         break;
+       }
+    }
 
   if (context->state == STATE_ERROR)
     {