From: Matthias Clasen Date: Tue, 7 May 2002 21:45:21 +0000 (+0000) Subject: Report unfinished entity references as errors rather than running into an X-Git-Tag: R_2_0_core~106 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6853c2b8806443ad80bdb99200502d9975398780;p=platform%2Fupstream%2Fglib.git Report unfinished entity references as errors rather than running into an * glib/gmarkup.c (unescape_text): Report unfinished entity references as errors rather than running into an assert. (#80441) --- diff --git a/ChangeLog b/ChangeLog index e500835..b8afb0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-05-07 Matthias Clasen + + * glib/gmarkup.c (unescape_text): Report unfinished entity + references as errors rather than running into an assert. (#80441) + 2002-05-07 Michael Natterer * configure.in: added a new conditional CROSS_COMPILING which diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e500835..b8afb0c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2002-05-07 Matthias Clasen + + * glib/gmarkup.c (unescape_text): Report unfinished entity + references as errors rather than running into an assert. (#80441) + 2002-05-07 Michael Natterer * configure.in: added a new conditional CROSS_COMPILING which diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index e500835..b8afb0c 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2002-05-07 Matthias Clasen + + * glib/gmarkup.c (unescape_text): Report unfinished entity + references as errors rather than running into an assert. (#80441) + 2002-05-07 Michael Natterer * configure.in: added a new conditional CROSS_COMPILING which diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e500835..b8afb0c 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2002-05-07 Matthias Clasen + + * glib/gmarkup.c (unescape_text): Report unfinished entity + references as errors rather than running into an assert. (#80441) + 2002-05-07 Michael Natterer * configure.in: added a new conditional CROSS_COMPILING which diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e500835..b8afb0c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2002-05-07 Matthias Clasen + + * glib/gmarkup.c (unescape_text): Report unfinished entity + references as errors rather than running into an assert. (#80441) + 2002-05-07 Michael Natterer * configure.in: added a new conditional CROSS_COMPILING which diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e500835..b8afb0c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2002-05-07 Matthias Clasen + + * glib/gmarkup.c (unescape_text): Report unfinished entity + references as errors rather than running into an assert. (#80441) + 2002-05-07 Michael Natterer * configure.in: added a new conditional CROSS_COMPILING which diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e500835..b8afb0c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2002-05-07 Matthias Clasen + + * glib/gmarkup.c (unescape_text): Report unfinished entity + references as errors rather than running into an assert. (#80441) + 2002-05-07 Michael Natterer * configure.in: added a new conditional CROSS_COMPILING which diff --git a/glib/gmarkup.c b/glib/gmarkup.c index 39ff57b..8f5c6b8 100644 --- a/glib/gmarkup.c +++ b/glib/gmarkup.c @@ -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) {