mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
25
parser.c
25
parser.c
@@ -9856,22 +9856,20 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
|
|||||||
r = CUR_CHAR(rl);
|
r = CUR_CHAR(rl);
|
||||||
if (!IS_CHAR(r)) {
|
if (!IS_CHAR(r)) {
|
||||||
xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL);
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
goto out;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
NEXTL(rl);
|
NEXTL(rl);
|
||||||
s = CUR_CHAR(sl);
|
s = CUR_CHAR(sl);
|
||||||
if (!IS_CHAR(s)) {
|
if (!IS_CHAR(s)) {
|
||||||
xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL);
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
goto out;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
NEXTL(sl);
|
NEXTL(sl);
|
||||||
cur = CUR_CHAR(l);
|
cur = CUR_CHAR(l);
|
||||||
buf = (xmlChar *) xmlMallocAtomic(size);
|
buf = (xmlChar *) xmlMallocAtomic(size);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
xmlErrMemory(ctxt, NULL);
|
xmlErrMemory(ctxt, NULL);
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
while (IS_CHAR(cur) &&
|
while (IS_CHAR(cur) &&
|
||||||
((r != ']') || (s != ']') || (cur != '>'))) {
|
((r != ']') || (s != ']') || (cur != '>'))) {
|
||||||
@@ -9880,9 +9878,8 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
|
|||||||
|
|
||||||
tmp = (xmlChar *) xmlRealloc(buf, size * 2);
|
tmp = (xmlChar *) xmlRealloc(buf, size * 2);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
xmlFree(buf);
|
|
||||||
xmlErrMemory(ctxt, NULL);
|
xmlErrMemory(ctxt, NULL);
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
buf = tmp;
|
buf = tmp;
|
||||||
size *= 2;
|
size *= 2;
|
||||||
@@ -9897,8 +9894,7 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
|
|||||||
SHRINK;
|
SHRINK;
|
||||||
GROW;
|
GROW;
|
||||||
if (ctxt->instate == XML_PARSER_EOF) {
|
if (ctxt->instate == XML_PARSER_EOF) {
|
||||||
xmlFree(buf);
|
goto out;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
@@ -9907,17 +9903,14 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
|
|||||||
if (len > maxLength) {
|
if (len > maxLength) {
|
||||||
xmlFatalErrMsg(ctxt, XML_ERR_CDATA_NOT_FINISHED,
|
xmlFatalErrMsg(ctxt, XML_ERR_CDATA_NOT_FINISHED,
|
||||||
"CData section too big found\n");
|
"CData section too big found\n");
|
||||||
xmlFree(buf);
|
goto out;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
|
||||||
if (cur != '>') {
|
if (cur != '>') {
|
||||||
xmlFatalErrMsgStr(ctxt, XML_ERR_CDATA_NOT_FINISHED,
|
xmlFatalErrMsgStr(ctxt, XML_ERR_CDATA_NOT_FINISHED,
|
||||||
"CData section not finished\n%.50s\n", buf);
|
"CData section not finished\n%.50s\n", buf);
|
||||||
xmlFree(buf);
|
goto out;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
NEXTL(l);
|
NEXTL(l);
|
||||||
|
|
||||||
@@ -9930,6 +9923,10 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
|
|||||||
else if (ctxt->sax->characters != NULL)
|
else if (ctxt->sax->characters != NULL)
|
||||||
ctxt->sax->characters(ctxt->userData, buf, len);
|
ctxt->sax->characters(ctxt->userData, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (ctxt->instate != XML_PARSER_EOF)
|
||||||
|
ctxt->instate = XML_PARSER_CONTENT;
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user