diff options
author | Daniel Veillard <veillard@redhat.com> | 2015-09-18 15:06:46 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2015-09-18 15:06:46 +0800 |
commit | 4a5d80aded1da94cd55294e7207109712201b75b (patch) | |
tree | c3517c31e176291385657813634a7975974b2159 /parser.c | |
parent | 51f02b0a03ea1fa6c65b3f9fd88cf60fb5803783 (diff) | |
download | android_external_libxml2-4a5d80aded1da94cd55294e7207109712201b75b.tar.gz android_external_libxml2-4a5d80aded1da94cd55294e7207109712201b75b.tar.bz2 android_external_libxml2-4a5d80aded1da94cd55294e7207109712201b75b.zip |
Fix a bug in CData error handling in the push parser
For https://bugzilla.gnome.org/show_bug.cgi?id=754947
The checking function was returning incorrect args in some cases
Adds the test to teh reg suite and fix one of the existing test output
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -11192,7 +11192,7 @@ xmlCheckCdataPush(const xmlChar *utf, int len) { else return(-ix); } else if ((c & 0xe0) == 0xc0) {/* 2-byte code, starts with 110 */ - if (ix + 2 > len) return(ix); + if (ix + 2 > len) return(-ix); if ((utf[ix+1] & 0xc0 ) != 0x80) return(-ix); codepoint = (utf[ix] & 0x1f) << 6; @@ -11201,7 +11201,7 @@ xmlCheckCdataPush(const xmlChar *utf, int len) { return(-ix); ix += 2; } else if ((c & 0xf0) == 0xe0) {/* 3-byte code, starts with 1110 */ - if (ix + 3 > len) return(ix); + if (ix + 3 > len) return(-ix); if (((utf[ix+1] & 0xc0) != 0x80) || ((utf[ix+2] & 0xc0) != 0x80)) return(-ix); @@ -11212,7 +11212,7 @@ xmlCheckCdataPush(const xmlChar *utf, int len) { return(-ix); ix += 3; } else if ((c & 0xf8) == 0xf0) {/* 4-byte code, starts with 11110 */ - if (ix + 4 > len) return(ix); + if (ix + 4 > len) return(-ix); if (((utf[ix+1] & 0xc0) != 0x80) || ((utf[ix+2] & 0xc0) != 0x80) || ((utf[ix+3] & 0xc0) != 0x80)) |