From 96b9935a7cc7d2cd67771451ebe8e1e5e230dc9f Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 11 Nov 2000 17:09:15 +0000 Subject: [PATCH] Handle a long stream of bytes containing no UTF-8 character starts 2000-11-11 Havoc Pennington * gmarkup.c (g_markup_parse_context_parse): Handle a long stream of bytes containing no UTF-8 character starts --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ glib/gmarkup.c | 11 +++++++++++ gmarkup.c | 11 +++++++++++ 10 files changed, 62 insertions(+) diff --git a/ChangeLog b/ChangeLog index df10217..0b6cae3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-11-11 Havoc Pennington + + * gmarkup.c (g_markup_parse_context_parse): Handle a long stream + of bytes containing no UTF-8 character starts + 2000-11-11 Tor Lillqvist * glib.def: Add missing entry points. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index df10217..0b6cae3 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +2000-11-11 Havoc Pennington + + * gmarkup.c (g_markup_parse_context_parse): Handle a long stream + of bytes containing no UTF-8 character starts + 2000-11-11 Tor Lillqvist * glib.def: Add missing entry points. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index df10217..0b6cae3 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2000-11-11 Havoc Pennington + + * gmarkup.c (g_markup_parse_context_parse): Handle a long stream + of bytes containing no UTF-8 character starts + 2000-11-11 Tor Lillqvist * glib.def: Add missing entry points. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index df10217..0b6cae3 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2000-11-11 Havoc Pennington + + * gmarkup.c (g_markup_parse_context_parse): Handle a long stream + of bytes containing no UTF-8 character starts + 2000-11-11 Tor Lillqvist * glib.def: Add missing entry points. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index df10217..0b6cae3 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2000-11-11 Havoc Pennington + + * gmarkup.c (g_markup_parse_context_parse): Handle a long stream + of bytes containing no UTF-8 character starts + 2000-11-11 Tor Lillqvist * glib.def: Add missing entry points. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index df10217..0b6cae3 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2000-11-11 Havoc Pennington + + * gmarkup.c (g_markup_parse_context_parse): Handle a long stream + of bytes containing no UTF-8 character starts + 2000-11-11 Tor Lillqvist * glib.def: Add missing entry points. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index df10217..0b6cae3 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2000-11-11 Havoc Pennington + + * gmarkup.c (g_markup_parse_context_parse): Handle a long stream + of bytes containing no UTF-8 character starts + 2000-11-11 Tor Lillqvist * glib.def: Add missing entry points. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index df10217..0b6cae3 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2000-11-11 Havoc Pennington + + * gmarkup.c (g_markup_parse_context_parse): Handle a long stream + of bytes containing no UTF-8 character starts + 2000-11-11 Tor Lillqvist * glib.def: Add missing entry points. diff --git a/glib/gmarkup.c b/glib/gmarkup.c index e955f7c..3df39b9 100644 --- a/glib/gmarkup.c +++ b/glib/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; } } diff --git a/gmarkup.c b/gmarkup.c index e955f7c..3df39b9 100644 --- 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; } } -- 2.7.4