mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-09 04:58:16 +03:00
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
This commit is contained in:
parent
51f02b0a03
commit
4a5d80aded
6
parser.c
6
parser.c
@ -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))
|
||||
|
0
result/errors/754947.xml
Normal file
0
result/errors/754947.xml
Normal file
7
result/errors/754947.xml.err
Normal file
7
result/errors/754947.xml.err
Normal file
@ -0,0 +1,7 @@
|
||||
./test/errors/754947.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
|
||||
Bytes: 0xEE 0x5D 0x5D 0x3E
|
||||
<d><![CDATA[0000000000000î]]>
|
||||
^
|
||||
./test/errors/754947.xml:1: parser error : Premature end of data in tag d line 1
|
||||
<d><![CDATA[0000000000000î]]>
|
||||
^
|
5
result/errors/754947.xml.str
Normal file
5
result/errors/754947.xml.str
Normal file
@ -0,0 +1,5 @@
|
||||
./test/errors/754947.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
|
||||
Bytes: 0xEE 0x5D 0x5D 0x3E
|
||||
<d><![CDATA[0000000000000î]]>
|
||||
^
|
||||
./test/errors/754947.xml : failed to parse
|
@ -1,5 +1,5 @@
|
||||
./test/errors/cdata.xml:2: parser error : Input is not proper UTF-8, indicate encoding !
|
||||
Bytes: 0x5B 0x43 0xE1 0x72
|
||||
Bytes: 0xE1 0x72 0x5D 0x5D
|
||||
<A><![CDATA[Cár]]></A>
|
||||
^
|
||||
^
|
||||
./test/errors/cdata.xml : failed to parse
|
||||
|
1
test/errors/754947.xml
Normal file
1
test/errors/754947.xml
Normal file
@ -0,0 +1 @@
|
||||
<d><![CDATA[0000000000000î]]>
|
Loading…
x
Reference in New Issue
Block a user