mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-12-25 23:21:26 +03:00
fixed a parser bug where invalid char in comment may not be detected,
* parser.c: fixed a parser bug where invalid char in comment may not be detected, reported by Ashwin Sinha * test/errors/comment1.xml result/errors/comment1.xml*: added the example to the regression suite Daniel svn path=/trunk/; revision=3647
This commit is contained in:
parent
3814a365d6
commit
da62934715
@ -1,3 +1,10 @@
|
||||
Wed Aug 1 09:50:12 CEST 2007 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* parser.c: fixed a parser bug where invalid char in comment may
|
||||
not be detected, reported by Ashwin Sinha
|
||||
* test/errors/comment1.xml result/errors/comment1.xml*: added
|
||||
the example to the regression suite
|
||||
|
||||
Thu Jul 26 13:42:26 CEST 2007 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xmlsave.c: fixed problem reported on bug #460415
|
||||
|
@ -25,7 +25,7 @@ URI library.
|
||||
%package devel
|
||||
Summary: Libraries, includes, etc. to develop XML and HTML applications
|
||||
Group: Development/Libraries
|
||||
Requires: libxml2 = %{version}
|
||||
Requires: libxml2 = %{version}-%{release}
|
||||
Requires: zlib-devel
|
||||
Requires: pkgconfig
|
||||
|
||||
@ -44,8 +44,8 @@ URI library.
|
||||
%package python
|
||||
Summary: Python bindings for the libxml2 library
|
||||
Group: Development/Libraries
|
||||
Requires: libxml2 = %{version}
|
||||
Requires: %{_libdir}/python%(echo `python -c "import sys; print sys.version[0:3]"`)
|
||||
Requires: libxml2 = %{version}-%{release}
|
||||
Requires: python
|
||||
|
||||
%description python
|
||||
The libxml2-python package contains a module that permits applications
|
||||
|
25
parser.c
25
parser.c
@ -3817,10 +3817,24 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) {
|
||||
q = CUR_CHAR(ql);
|
||||
if (q == 0)
|
||||
goto not_terminated;
|
||||
if (!IS_CHAR(q)) {
|
||||
xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
|
||||
"xmlParseComment: invalid xmlChar value %d\n",
|
||||
q);
|
||||
xmlFree (buf);
|
||||
return;
|
||||
}
|
||||
NEXTL(ql);
|
||||
r = CUR_CHAR(rl);
|
||||
if (r == 0)
|
||||
goto not_terminated;
|
||||
if (!IS_CHAR(r)) {
|
||||
xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
|
||||
"xmlParseComment: invalid xmlChar value %d\n",
|
||||
q);
|
||||
xmlFree (buf);
|
||||
return;
|
||||
}
|
||||
NEXTL(rl);
|
||||
cur = CUR_CHAR(l);
|
||||
if (cur == 0)
|
||||
@ -3862,10 +3876,13 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) {
|
||||
}
|
||||
}
|
||||
buf[len] = 0;
|
||||
if (!IS_CHAR(cur)) {
|
||||
if (cur == 0) {
|
||||
xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
|
||||
"Comment not terminated \n<!--%.50s\n", buf);
|
||||
xmlFree(buf);
|
||||
} else if (!IS_CHAR(cur)) {
|
||||
xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
|
||||
"xmlParseComment: invalid xmlChar value %d\n",
|
||||
cur);
|
||||
} else {
|
||||
if (input != ctxt->input) {
|
||||
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
|
||||
@ -3875,14 +3892,16 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) {
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
ctxt->sax->comment(ctxt->userData, buf);
|
||||
xmlFree(buf);
|
||||
}
|
||||
xmlFree(buf);
|
||||
return;
|
||||
not_terminated:
|
||||
xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
|
||||
"Comment not terminated\n", NULL);
|
||||
xmlFree(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlParseComment:
|
||||
* @ctxt: an XML parser context
|
||||
|
0
result/errors/comment1.xml
Normal file
0
result/errors/comment1.xml
Normal file
6
result/errors/comment1.xml.err
Normal file
6
result/errors/comment1.xml.err
Normal file
@ -0,0 +1,6 @@
|
||||
./test/errors/comment1.xml:5: parser error : xmlParseComment: invalid xmlChar value 14
|
||||
in p02: -->
|
||||
^
|
||||
./test/errors/comment1.xml:5: parser error : Start tag expected, '<' not found
|
||||
in p02: -->
|
||||
^
|
4
result/errors/comment1.xml.str
Normal file
4
result/errors/comment1.xml.str
Normal file
@ -0,0 +1,4 @@
|
||||
./test/errors/comment1.xml:5: parser error : xmlParseComment: invalid xmlChar value 14
|
||||
in p02: -->
|
||||
^
|
||||
./test/errors/comment1.xml : failed to parse
|
6
test/errors/comment1.xml
Normal file
6
test/errors/comment1.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE book [
|
||||
<!ELEMENT book ANY>
|
||||
]>
|
||||
<!-- IllegalChar #x0e
|
||||
in p02: -->
|
||||
<book/>
|
Loading…
Reference in New Issue
Block a user