From: Jürg Billeter Date: Sat, 17 Jan 2009 17:07:13 +0000 (+0000) Subject: Fix infinite loop when reading entity references X-Git-Tag: VALA_0_5_6~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dc45f6d7cd8bde9b165c6aeeabe22e74eb8d922;p=thirdparty%2Fvala.git Fix infinite loop when reading entity references 2009-01-17 Jürg Billeter * vapigen/valamarkupreader.vala: Fix infinite loop when reading entity references svn path=/trunk/; revision=2375 --- diff --git a/ChangeLog b/ChangeLog index 4d6b2bd23..dec2bb342 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-01-17 Jürg Billeter + + * vapigen/valamarkupreader.vala: + + Fix infinite loop when reading entity references + 2009-01-17 Jürg Billeter * vapigen/valamarkupreader.vala: diff --git a/vapigen/valamarkupreader.vala b/vapigen/valamarkupreader.vala index ef16b9e83..4db901397 100644 --- a/vapigen/valamarkupreader.vala +++ b/vapigen/valamarkupreader.vala @@ -153,17 +153,14 @@ public class Vala.MarkupReader : Object { current++; char* attr_begin = current; while (current < end && current[0] != '"') { - if (current[0] == '&') { - // process & > < " ' + unichar u = ((string) current).get_char_validated ((long) (end - current)); + if (u != (unichar) (-1)) { + current += u.to_utf8 (null); } else { - unichar u = ((string) current).get_char_validated ((long) (end - current)); - if (u != (unichar) (-1)) { - current += u.to_utf8 (null); - } else { - Report.error (null, "invalid UTF-8 character"); - } + Report.error (null, "invalid UTF-8 character"); } } + // TODO process & > < " ' string attr_value = ((string) attr_begin).ndup (current - attr_begin); if (current >= end || current[0] != '"') { // error @@ -188,15 +185,11 @@ public class Vala.MarkupReader : Object { space (); char* text_begin = current; while (current < end && current[0] != '<') { - if (current[0] == '&') { - // process & > < " ' + unichar u = ((string) current).get_char_validated ((long) (end - current)); + if (u != (unichar) (-1)) { + current += u.to_utf8 (null); } else { - unichar u = ((string) current).get_char_validated ((long) (end - current)); - if (u != (unichar) (-1)) { - current += u.to_utf8 (null); - } else { - Report.error (null, "invalid UTF-8 character"); - } + Report.error (null, "invalid UTF-8 character"); } } if (text_begin == current) { @@ -205,6 +198,7 @@ public class Vala.MarkupReader : Object { return read_token (out token_begin, out token_end); } type = MarkupTokenType.TEXT; + // TODO process & > < " ' // string text = ((string) text_begin).ndup (current - text_begin); }