mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
fixed a bug where invalid charrefs may not be detected sometimes as
* parser.c: fixed a bug where invalid charrefs may not be detected sometimes as pointed by Morus Walter. * test/errors/charref1.xm result/errors/charref1.xml*: added the test in the regression suite. Daniel
This commit is contained in:
parent
767265dd9c
commit
37fd307435
@ -1,3 +1,10 @@
|
||||
Thu Jun 3 13:20:36 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* parser.c: fixed a bug where invalid charrefs may not be detected
|
||||
sometimes as pointed by Morus Walter.
|
||||
* test/errors/charref1.xm result/errors/charref1.xml*: added the
|
||||
test in the regression suite.
|
||||
|
||||
Thu Jun 3 18:38:27 HKT 2004 William Brack <wbrack@mmm.com.hk>
|
||||
|
||||
* xmlschemas.c: small change to xmlSchemaValidateAttributes,
|
||||
|
20
parser.c
20
parser.c
@ -1456,6 +1456,7 @@ int
|
||||
xmlParseCharRef(xmlParserCtxtPtr ctxt) {
|
||||
unsigned int val = 0;
|
||||
int count = 0;
|
||||
unsigned int outofrange = 0;
|
||||
|
||||
/*
|
||||
* Using RAW/CUR/NEXT is okay since we are working on ASCII range here
|
||||
@ -1480,6 +1481,9 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
|
||||
val = 0;
|
||||
break;
|
||||
}
|
||||
if (val > 0x10FFFF)
|
||||
outofrange = val;
|
||||
|
||||
NEXT;
|
||||
count++;
|
||||
}
|
||||
@ -1504,6 +1508,9 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
|
||||
val = 0;
|
||||
break;
|
||||
}
|
||||
if (val > 0x10FFFF)
|
||||
outofrange = val;
|
||||
|
||||
NEXT;
|
||||
count++;
|
||||
}
|
||||
@ -1522,7 +1529,7 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
|
||||
* Characters referred to using character references must match the
|
||||
* production for Char.
|
||||
*/
|
||||
if (IS_CHAR(val)) {
|
||||
if ((IS_CHAR(val) && (outofrange == 0))) {
|
||||
return(val);
|
||||
} else {
|
||||
xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
|
||||
@ -1554,7 +1561,8 @@ static int
|
||||
xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
|
||||
const xmlChar *ptr;
|
||||
xmlChar cur;
|
||||
int val = 0;
|
||||
unsigned int val = 0;
|
||||
unsigned int outofrange = 0;
|
||||
|
||||
if ((str == NULL) || (*str == NULL)) return(0);
|
||||
ptr = *str;
|
||||
@ -1574,6 +1582,9 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
|
||||
val = 0;
|
||||
break;
|
||||
}
|
||||
if (val > 0x10FFFF)
|
||||
outofrange = val;
|
||||
|
||||
ptr++;
|
||||
cur = *ptr;
|
||||
}
|
||||
@ -1590,6 +1601,9 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
|
||||
val = 0;
|
||||
break;
|
||||
}
|
||||
if (val > 0x10FFFF)
|
||||
outofrange = val;
|
||||
|
||||
ptr++;
|
||||
cur = *ptr;
|
||||
}
|
||||
@ -1606,7 +1620,7 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
|
||||
* Characters referred to using character references must match the
|
||||
* production for Char.
|
||||
*/
|
||||
if (IS_CHAR(val)) {
|
||||
if ((IS_CHAR(val) && (outofrange == 0))) {
|
||||
return(val);
|
||||
} else {
|
||||
xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
|
||||
|
0
result/errors/charref1.xml
Normal file
0
result/errors/charref1.xml
Normal file
3
result/errors/charref1.xml.err
Normal file
3
result/errors/charref1.xml.err
Normal file
@ -0,0 +1,3 @@
|
||||
./test/errors/charref1.xml:1: parser error : xmlParseCharRef: invalid xmlChar value 60
|
||||
<bla>�</bla>
|
||||
^
|
3
result/errors/charref1.xml.str
Normal file
3
result/errors/charref1.xml.str
Normal file
@ -0,0 +1,3 @@
|
||||
./test/errors/charref1.xml:1: parser error : xmlParseCharRef: invalid xmlChar value 60
|
||||
<bla>�</bla>
|
||||
^
|
1
test/errors/charref1.xml
Normal file
1
test/errors/charref1.xml
Normal file
@ -0,0 +1 @@
|
||||
<bla>�</bla>
|
Loading…
x
Reference in New Issue
Block a user