mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-07 06:43:02 +03:00
fixed bug #108546 on long CDATA (or text nodes) reported by Edd Dumbill
* xmlreader.c: fixed bug #108546 on long CDATA (or text nodes) reported by Edd Dumbill Daniel
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
Sat Mar 22 01:57:40 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xmlreader.c: fixed bug #108546 on long CDATA (or text nodes)
|
||||||
|
reported by Edd Dumbill
|
||||||
|
|
||||||
Sat Mar 23 01:00:24 CET 2003 Daniel Veillard <daniel@veillard.com>
|
Sat Mar 23 01:00:24 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* HTMLparser.c parser.c parserInternals.c: patch from
|
* HTMLparser.c parser.c parserInternals.c: patch from
|
||||||
|
39
xmlreader.c
39
xmlreader.c
@@ -632,6 +632,45 @@ get_next_node:
|
|||||||
if (reader->node == NULL)
|
if (reader->node == NULL)
|
||||||
goto node_end;
|
goto node_end;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* If we are in the middle of a piece of CDATA make sure it's finished
|
||||||
|
* Maybe calling a function checking that a non-character() callback was
|
||||||
|
* received would be cleaner for the loop exit.
|
||||||
|
*/
|
||||||
|
if ((oldstate == XML_TEXTREADER_ELEMENT) &&
|
||||||
|
(reader->ctxt->instate == XML_PARSER_CDATA_SECTION)) {
|
||||||
|
while ((reader->ctxt->instate == XML_PARSER_CDATA_SECTION) &&
|
||||||
|
(((reader->node->content == NULL) &&
|
||||||
|
(reader->node->next != NULL) &&
|
||||||
|
(reader->node->next->type == XML_CDATA_SECTION_NODE) &&
|
||||||
|
(reader->node->next->next == NULL) &&
|
||||||
|
(reader->node->parent->next == NULL)) ||
|
||||||
|
((reader->node->children != NULL) &&
|
||||||
|
(reader->node->children->type == XML_CDATA_SECTION_NODE) &&
|
||||||
|
(reader->node->children->next == NULL) &&
|
||||||
|
(reader->node->children->next == NULL)))) {
|
||||||
|
val = xmlTextReaderPushData(reader);
|
||||||
|
if (val < 0)
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((oldstate == XML_TEXTREADER_ELEMENT) &&
|
||||||
|
(reader->ctxt->instate == XML_PARSER_CONTENT)) {
|
||||||
|
while ((reader->ctxt->instate == XML_PARSER_CONTENT) &&
|
||||||
|
(((reader->node->content == NULL) &&
|
||||||
|
(reader->node->next != NULL) &&
|
||||||
|
(reader->node->next->type == XML_TEXT_NODE) &&
|
||||||
|
(reader->node->next->next == NULL) &&
|
||||||
|
(reader->node->parent->next == NULL)) ||
|
||||||
|
((reader->node->children != NULL) &&
|
||||||
|
(reader->node->children->type == XML_TEXT_NODE) &&
|
||||||
|
(reader->node->children->next == NULL) &&
|
||||||
|
(reader->node->children->next == NULL)))) {
|
||||||
|
val = xmlTextReaderPushData(reader);
|
||||||
|
if (val < 0)
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (oldstate != XML_TEXTREADER_BACKTRACK) {
|
if (oldstate != XML_TEXTREADER_BACKTRACK) {
|
||||||
if ((reader->node->children != NULL) &&
|
if ((reader->node->children != NULL) &&
|
||||||
(reader->node->type != XML_ENTITY_REF_NODE) &&
|
(reader->node->type != XML_ENTITY_REF_NODE) &&
|
||||||
|
Reference in New Issue
Block a user