Handle a long stream of bytes containing no UTF-8 character starts
authorHavoc Pennington <hp@pobox.com>
Sat, 11 Nov 2000 17:09:15 +0000 (17:09 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Sat, 11 Nov 2000 17:09:15 +0000 (17:09 +0000)
2000-11-11  Havoc Pennington  <hp@pobox.com>

* gmarkup.c (g_markup_parse_context_parse): Handle a long stream
of bytes containing no UTF-8 character starts

ChangeLog
ChangeLog.pre-2-0
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
gmarkup.c

index df10217..0b6cae3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-11  Havoc Pennington  <hp@pobox.com>
+
+       * gmarkup.c (g_markup_parse_context_parse): Handle a long stream
+       of bytes containing no UTF-8 character starts
+
 2000-11-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib.def: Add missing entry points.
index df10217..0b6cae3 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-11  Havoc Pennington  <hp@pobox.com>
+
+       * gmarkup.c (g_markup_parse_context_parse): Handle a long stream
+       of bytes containing no UTF-8 character starts
+
 2000-11-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib.def: Add missing entry points.
index df10217..0b6cae3 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-11  Havoc Pennington  <hp@pobox.com>
+
+       * gmarkup.c (g_markup_parse_context_parse): Handle a long stream
+       of bytes containing no UTF-8 character starts
+
 2000-11-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib.def: Add missing entry points.
index df10217..0b6cae3 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-11  Havoc Pennington  <hp@pobox.com>
+
+       * gmarkup.c (g_markup_parse_context_parse): Handle a long stream
+       of bytes containing no UTF-8 character starts
+
 2000-11-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib.def: Add missing entry points.
index df10217..0b6cae3 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-11  Havoc Pennington  <hp@pobox.com>
+
+       * gmarkup.c (g_markup_parse_context_parse): Handle a long stream
+       of bytes containing no UTF-8 character starts
+
 2000-11-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib.def: Add missing entry points.
index df10217..0b6cae3 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-11  Havoc Pennington  <hp@pobox.com>
+
+       * gmarkup.c (g_markup_parse_context_parse): Handle a long stream
+       of bytes containing no UTF-8 character starts
+
 2000-11-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib.def: Add missing entry points.
index df10217..0b6cae3 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-11  Havoc Pennington  <hp@pobox.com>
+
+       * gmarkup.c (g_markup_parse_context_parse): Handle a long stream
+       of bytes containing no UTF-8 character starts
+
 2000-11-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib.def: Add missing entry points.
index df10217..0b6cae3 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-11  Havoc Pennington  <hp@pobox.com>
+
+       * gmarkup.c (g_markup_parse_context_parse): Handle a long stream
+       of bytes containing no UTF-8 character starts
+
 2000-11-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib.def: Add missing entry points.
index e955f7c..3df39b9 100644 (file)
@@ -889,6 +889,17 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
           g_string_append_len (context->leftover_char_portion,
                                text, text_len);
 
+          if (context->leftover_char_portion->len > 7)
+            {
+              /* The leftover char portion is too big to be
+               * a UTF-8 character
+               */
+              set_error (context,
+                         error,
+                         G_MARKUP_ERROR_BAD_UTF8,
+                         _("Invalid UTF-8 encoded text"));
+            }
+          
           goto finished;
         }
     }
index e955f7c..3df39b9 100644 (file)
--- a/gmarkup.c
+++ b/gmarkup.c
@@ -889,6 +889,17 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
           g_string_append_len (context->leftover_char_portion,
                                text, text_len);
 
+          if (context->leftover_char_portion->len > 7)
+            {
+              /* The leftover char portion is too big to be
+               * a UTF-8 character
+               */
+              set_error (context,
+                         error,
+                         G_MARKUP_ERROR_BAD_UTF8,
+                         _("Invalid UTF-8 encoded text"));
+            }
+          
           goto finished;
         }
     }