forked from pool/libxml2
- version update to 2.14.5
2.14.0
** Major changes **
o The HTML tokenizer now conforms fully to HTML5.
o Binary compatibility is restricted to versions 2.14 or newer.
The soname was bumped from libxml2.so.2 to libxml2.so.16.
o The serialization API will now take user-provided or default
encodings into account when serializing attribute values.
o The XML parser won't try to merge consecutive CDATA sections
as before to align with web standards.
o Support for RELAX NG can now be disabled with a new configuration
option independently of XML Schemas support.
o The "legacy" configuration option won't enable support for HTTP
and LZMA anymore.
o Parts of the xmllint executable were refactored, allowing the
combination of more options.
o Meson is fully supported now.
o Parts of the buffering code were reworked and simplified.
o Overflow checks before reallocations were hardenend.
o Some unprefixed symbols were renamed to avoid namespace pollution.
** New features **
o Input callbacks can now be set on a parser context and an improved
API to create parser input is available.
o The following new functions, taking a parser input object, were added:
. xmlCtxtParseDocument
. xmlCtxtParseContent
. xmlCtxtParseDtd
o The xmlSave API now has additional options to replace global settings.
o Parser options XML_PARSE_UNZIP, XML_PARSE_NO_SYS_CATALOG and
XML_PARSE_CATALOG_PI were added.
OBS-URL: https://build.opensuse.org/request/show/1302350
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libxml2?expand=0&rev=252
552 lines
20 KiB
Diff
552 lines
20 KiB
Diff
From b7d2ad6e1b376c10edffcb0973485c861dc89559 Mon Sep 17 00:00:00 2001
|
|
From: David Kilzer <ddkilzer@apple.com>
|
|
Date: Mon, 23 Jun 2025 14:41:56 -0700
|
|
Subject: [PATCH] libxslt: heap-use-after-free in xmlFreeID caused by `atype`
|
|
corruption
|
|
|
|
* include/libxml/tree.h:
|
|
(XML_ATTR_CLEAR_ATYPE): Add.
|
|
(XML_ATTR_GET_ATYPE): Add.
|
|
(XML_ATTR_SET_ATYPE): Add.
|
|
(XML_NODE_ADD_EXTRA): Add.
|
|
(XML_NODE_CLEAR_EXTRA): Add.
|
|
(XML_NODE_GET_EXTRA): Add.
|
|
(XML_NODE_SET_EXTRA): Add.
|
|
(XML_DOC_ADD_PROPERTIES): Add.
|
|
(XML_DOC_CLEAR_PROPERTIES): Add.
|
|
(XML_DOC_GET_PROPERTIES): Add.
|
|
(XML_DOC_SET_PROPERTIES): Add.
|
|
- Add macros for accessing fields with upper bits that may be set by
|
|
libxslt.
|
|
|
|
* HTMLparser.c:
|
|
(htmlNewDocNoDtD):
|
|
* SAX2.c:
|
|
(xmlSAX2StartDocument):
|
|
(xmlSAX2EndDocument):
|
|
* parser.c:
|
|
(xmlParseEntityDecl):
|
|
(xmlParseExternalSubset):
|
|
(xmlParseReference):
|
|
(xmlCtxtParseDtd):
|
|
* runxmlconf.c:
|
|
(xmlconfTestInvalid):
|
|
(xmlconfTestValid):
|
|
* tree.c:
|
|
(xmlNewDoc):
|
|
(xmlFreeProp):
|
|
(xmlNodeSetDoc):
|
|
(xmlSetNsProp):
|
|
(xmlDOMWrapAdoptBranch):
|
|
* valid.c:
|
|
(xmlFreeID):
|
|
(xmlAddIDInternal):
|
|
(xmlValidateAttributeValueInternal):
|
|
(xmlValidateOneAttribute):
|
|
(xmlValidateRef):
|
|
* xmlreader.c:
|
|
(xmlTextReaderStartElement):
|
|
(xmlTextReaderStartElementNs):
|
|
(xmlTextReaderValidateEntity):
|
|
(xmlTextReaderRead):
|
|
(xmlTextReaderNext):
|
|
(xmlTextReaderIsEmptyElement):
|
|
(xmlTextReaderPreserve):
|
|
* xmlschemas.c:
|
|
(xmlSchemaPValAttrNodeID):
|
|
* xmlschemastypes.c:
|
|
(xmlSchemaValAtomicType):
|
|
- Adopt macros by renaming the struct fields, recompiling and fixing
|
|
compiler failures, then changing the struct field names back.
|
|
---
|
|
HTMLparser.c | 2 +-
|
|
SAX2.c | 14 +++++++-------
|
|
include/libxml/tree.h | 14 +++++++++++++-
|
|
parser.c | 10 +++++-----
|
|
runxmlconf.c | 4 ++--
|
|
tree.c | 14 +++++++-------
|
|
valid.c | 14 +++++++-------
|
|
xmlreader.c | 30 +++++++++++++++---------------
|
|
xmlschemas.c | 2 +-
|
|
xmlschemastypes.c | 10 +++++-----
|
|
10 files changed, 63 insertions(+), 51 deletions(-)
|
|
|
|
Index: libxml2-2.14.5/HTMLparser.c
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/HTMLparser.c
|
|
+++ libxml2-2.14.5/HTMLparser.c
|
|
@@ -2279,7 +2279,7 @@ htmlNewDocNoDtD(const xmlChar *URI, cons
|
|
cur->refs = NULL;
|
|
cur->_private = NULL;
|
|
cur->charset = XML_CHAR_ENCODING_UTF8;
|
|
- cur->properties = XML_DOC_HTML | XML_DOC_USERBUILT;
|
|
+ XML_DOC_SET_PROPERTIES(cur, XML_DOC_HTML | XML_DOC_USERBUILT);
|
|
if ((ExternalID != NULL) ||
|
|
(URI != NULL)) {
|
|
xmlDtdPtr intSubset;
|
|
Index: libxml2-2.14.5/SAX2.c
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/SAX2.c
|
|
+++ libxml2-2.14.5/SAX2.c
|
|
@@ -823,16 +823,16 @@ xmlSAX2StartDocument(void *ctx)
|
|
xmlSAX2ErrMemory(ctxt);
|
|
return;
|
|
}
|
|
- ctxt->myDoc->properties = XML_DOC_HTML;
|
|
+ XML_DOC_SET_PROPERTIES(ctxt->myDoc, XML_DOC_HTML);
|
|
ctxt->myDoc->parseFlags = ctxt->options;
|
|
} else
|
|
#endif
|
|
{
|
|
doc = ctxt->myDoc = xmlNewDoc(ctxt->version);
|
|
if (doc != NULL) {
|
|
- doc->properties = 0;
|
|
+ XML_DOC_CLEAR_PROPERTIES(doc);
|
|
if (ctxt->options & XML_PARSE_OLD10)
|
|
- doc->properties |= XML_DOC_OLD10;
|
|
+ XML_DOC_ADD_PROPERTIES(doc, XML_DOC_OLD10);
|
|
doc->parseFlags = ctxt->options;
|
|
doc->standalone = ctxt->standalone;
|
|
} else {
|
|
Index: libxml2-2.14.5/include/libxml/tree.h
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/include/libxml/tree.h
|
|
+++ libxml2-2.14.5/include/libxml/tree.h
|
|
@@ -374,7 +374,6 @@ struct _xmlElement {
|
|
#endif
|
|
};
|
|
|
|
-
|
|
/**
|
|
* XML_LOCAL_NAMESPACE:
|
|
*
|
|
@@ -462,6 +461,10 @@ struct _xmlAttr {
|
|
* An XML ID instance.
|
|
*/
|
|
|
|
+#define XML_ATTR_CLEAR_ATYPE(attr) (((attr)->atype) = 0)
|
|
+#define XML_ATTR_GET_ATYPE(attr) (((attr)->atype) & ~(15U << 27))
|
|
+#define XML_ATTR_SET_ATYPE(attr, type) ((attr)->atype = ((((attr)->atype) & (15U << 27)) | ((type) & ~(15U << 27))))
|
|
+
|
|
typedef struct _xmlID xmlID;
|
|
typedef xmlID *xmlIDPtr;
|
|
struct _xmlID {
|
|
@@ -551,6 +554,11 @@ typedef enum {
|
|
XML_DOC_HTML = 1<<7 /* parsed or built HTML document */
|
|
} xmlDocProperties;
|
|
|
|
+#define XML_NODE_ADD_EXTRA(node, type) ((node)->extra |= ((type) & ~(15U << 12)))
|
|
+#define XML_NODE_CLEAR_EXTRA(node) (((node)->extra) = 0)
|
|
+#define XML_NODE_GET_EXTRA(node) (((node)->extra) & ~(15U << 12))
|
|
+#define XML_NODE_SET_EXTRA(node, type) ((node)->extra = ((((node)->extra) & (15U << 12)) | ((type) & ~(15U << 12))))
|
|
+
|
|
/**
|
|
* xmlDoc:
|
|
*
|
|
@@ -594,6 +602,10 @@ struct _xmlDoc {
|
|
set at the end of parsing */
|
|
};
|
|
|
|
+#define XML_DOC_ADD_PROPERTIES(doc, type) ((doc)->properties |= ((type) & ~(15U << 27)))
|
|
+#define XML_DOC_CLEAR_PROPERTIES(doc) (((doc)->properties) = 0)
|
|
+#define XML_DOC_GET_PROPERTIES(doc) (((doc)->properties) & ~(15U << 27))
|
|
+#define XML_DOC_SET_PROPERTIES(doc, type) ((doc)->properties = ((((doc)->properties) & (15U << 27)) | ((type) & ~(15U << 27))))
|
|
|
|
typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt;
|
|
typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr;
|
|
Index: libxml2-2.14.5/parser.c
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/parser.c
|
|
+++ libxml2-2.14.5/parser.c
|
|
@@ -5782,7 +5782,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt
|
|
xmlErrMemory(ctxt);
|
|
goto done;
|
|
}
|
|
- ctxt->myDoc->properties = XML_DOC_INTERNAL;
|
|
+ XML_DOC_SET_PROPERTIES(ctxt->myDoc, XML_DOC_INTERNAL);
|
|
}
|
|
if (ctxt->myDoc->intSubset == NULL) {
|
|
ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc,
|
|
@@ -5840,7 +5840,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt
|
|
xmlErrMemory(ctxt);
|
|
goto done;
|
|
}
|
|
- ctxt->myDoc->properties = XML_DOC_INTERNAL;
|
|
+ XML_DOC_SET_PROPERTIES(ctxt->myDoc, XML_DOC_INTERNAL);
|
|
}
|
|
|
|
if (ctxt->myDoc->intSubset == NULL) {
|
|
@@ -7280,7 +7280,7 @@ xmlParseExternalSubset(xmlParserCtxtPtr
|
|
xmlErrMemory(ctxt);
|
|
return;
|
|
}
|
|
- ctxt->myDoc->properties = XML_DOC_INTERNAL;
|
|
+ XML_DOC_SET_PROPERTIES(ctxt->myDoc, XML_DOC_INTERNAL);
|
|
}
|
|
if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL) &&
|
|
(xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID) == NULL)) {
|
|
@@ -7544,7 +7544,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt)
|
|
|
|
if (ctxt->parseMode == XML_PARSE_READER) {
|
|
/* Needed for reader */
|
|
- copy->extra = cur->extra;
|
|
+ XML_NODE_SET_EXTRA(copy, XML_NODE_GET_EXTRA(cur));
|
|
/* Maybe needed for reader */
|
|
copy->_private = cur->_private;
|
|
}
|
|
@@ -11772,7 +11772,7 @@ xmlCtxtParseDtd(xmlParserCtxtPtr ctxt, x
|
|
xmlErrMemory(ctxt);
|
|
goto error;
|
|
}
|
|
- ctxt->myDoc->properties = XML_DOC_INTERNAL;
|
|
+ XML_DOC_SET_PROPERTIES(ctxt->myDoc, XML_DOC_INTERNAL);
|
|
ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none",
|
|
publicId, systemId);
|
|
if (ctxt->myDoc->extSubset == NULL) {
|
|
Index: libxml2-2.14.5/runxmlconf.c
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/runxmlconf.c
|
|
+++ libxml2-2.14.5/runxmlconf.c
|
|
@@ -180,7 +180,7 @@ xmlconfTestInvalid(const char *id, const
|
|
id, filename);
|
|
} else {
|
|
/* invalidity should be reported both in the context and in the document */
|
|
- if ((ctxt->valid != 0) || (doc->properties & XML_DOC_DTDVALID)) {
|
|
+ if ((ctxt->valid != 0) || (XML_DOC_GET_PROPERTIES(doc) & XML_DOC_DTDVALID)) {
|
|
test_log("test %s : %s failed to detect invalid document\n",
|
|
id, filename);
|
|
nb_errors++;
|
|
@@ -213,7 +213,7 @@ xmlconfTestValid(const char *id, const c
|
|
ret = 0;
|
|
} else {
|
|
/* validity should be reported both in the context and in the document */
|
|
- if ((ctxt->valid == 0) || ((doc->properties & XML_DOC_DTDVALID) == 0)) {
|
|
+ if ((ctxt->valid == 0) || ((XML_DOC_GET_PROPERTIES(doc) & XML_DOC_DTDVALID) == 0)) {
|
|
test_log("test %s : %s failed to validate a valid document\n",
|
|
id, filename);
|
|
nb_errors++;
|
|
Index: libxml2-2.14.5/tree.c
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/tree.c
|
|
+++ libxml2-2.14.5/tree.c
|
|
@@ -1084,7 +1084,7 @@ xmlNewDoc(const xmlChar *version) {
|
|
cur->compression = -1; /* not initialized */
|
|
cur->doc = cur;
|
|
cur->parseFlags = 0;
|
|
- cur->properties = XML_DOC_USERBUILT;
|
|
+ XML_DOC_SET_PROPERTIES(cur, XML_DOC_USERBUILT);
|
|
/*
|
|
* The in memory encoding is always UTF8
|
|
* This field will never change and would
|
|
@@ -1892,7 +1892,7 @@ xmlFreeProp(xmlAttrPtr cur) {
|
|
xmlDeregisterNodeDefaultValue((xmlNodePtr)cur);
|
|
|
|
/* Check for ID removal -> leading to invalid references ! */
|
|
- if ((cur->doc != NULL) && (cur->atype == XML_ATTRIBUTE_ID)) {
|
|
+ if ((cur->doc != NULL) && (XML_ATTR_GET_ATYPE(cur) == XML_ATTRIBUTE_ID)) {
|
|
xmlRemoveID(cur->doc, cur);
|
|
}
|
|
if (cur->children != NULL) xmlFreeNodeList(cur->children);
|
|
@@ -2736,7 +2736,7 @@ xmlNodeSetDoc(xmlNodePtr node, xmlDocPtr
|
|
* TODO: ID attributes should also be added to the new
|
|
* document, but it's not clear how to handle clashes.
|
|
*/
|
|
- if (attr->atype == XML_ATTRIBUTE_ID)
|
|
+ if (XML_ATTR_GET_ATYPE(attr) == XML_ATTRIBUTE_ID)
|
|
xmlRemoveID(oldDoc, attr);
|
|
|
|
break;
|
|
@@ -6919,9 +6919,9 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr n
|
|
return(NULL);
|
|
}
|
|
|
|
- if (prop->atype == XML_ATTRIBUTE_ID) {
|
|
+ if (XML_ATTR_GET_ATYPE(prop) == XML_ATTRIBUTE_ID) {
|
|
xmlRemoveID(node->doc, prop);
|
|
- prop->atype = XML_ATTRIBUTE_ID;
|
|
+ XML_ATTR_SET_ATYPE(prop, XML_ATTRIBUTE_ID);
|
|
}
|
|
if (prop->children != NULL)
|
|
xmlFreeNodeList(prop->children);
|
|
@@ -6941,7 +6941,7 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr n
|
|
tmp = tmp->next;
|
|
}
|
|
}
|
|
- if ((prop->atype == XML_ATTRIBUTE_ID) &&
|
|
+ if ((XML_ATTR_GET_ATYPE(prop) == XML_ATTRIBUTE_ID) &&
|
|
(xmlAddIDSafe(prop, value) < 0)) {
|
|
return(NULL);
|
|
}
|
|
@@ -8402,7 +8402,7 @@ ns_end:
|
|
if (cur->type == XML_ELEMENT_NODE) {
|
|
cur->psvi = NULL;
|
|
cur->line = 0;
|
|
- cur->extra = 0;
|
|
+ XML_NODE_CLEAR_EXTRA(cur);
|
|
/*
|
|
* Walk attributes.
|
|
*/
|
|
Index: libxml2-2.14.5/valid.c
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/valid.c
|
|
+++ libxml2-2.14.5/valid.c
|
|
@@ -2316,7 +2316,7 @@ xmlFreeID(xmlIDPtr id) {
|
|
DICT_FREE(id->name)
|
|
if (id->attr != NULL) {
|
|
id->attr->id = NULL;
|
|
- id->attr->atype = 0;
|
|
+ XML_ATTR_CLEAR_ATYPE(id->attr);
|
|
}
|
|
|
|
xmlFree(id);
|
|
@@ -2395,7 +2395,7 @@ xmlAddIDInternal(xmlAttrPtr attr, const
|
|
|
|
id->attr = attr;
|
|
id->lineno = xmlGetLineNo(attr->parent);
|
|
- attr->atype = XML_ATTRIBUTE_ID;
|
|
+ XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_ID);
|
|
attr->id = id;
|
|
|
|
return(ret);
|
|
@@ -3275,7 +3275,7 @@ xmlValidNormalizeString(xmlChar *str) {
|
|
|
|
static int
|
|
xmlIsDocNameStartChar(xmlDocPtr doc, int c) {
|
|
- if ((doc == NULL) || (doc->properties & XML_DOC_OLD10) == 0) {
|
|
+ if ((doc == NULL) || (XML_DOC_GET_PROPERTIES(doc) & XML_DOC_OLD10) == 0) {
|
|
/*
|
|
* Use the new checks of production [4] [4a] amd [5] of the
|
|
* Update 5 of XML-1.0
|
|
@@ -3305,7 +3305,7 @@ xmlIsDocNameStartChar(xmlDocPtr doc, int
|
|
|
|
static int
|
|
xmlIsDocNameChar(xmlDocPtr doc, int c) {
|
|
- if ((doc == NULL) || (doc->properties & XML_DOC_OLD10) == 0) {
|
|
+ if ((doc == NULL) || (XML_DOC_GET_PROPERTIES(doc) & XML_DOC_OLD10) == 0) {
|
|
/*
|
|
* Use the new checks of production [4] [4a] amd [5] of the
|
|
* Update 5 of XML-1.0
|
|
@@ -4296,9 +4296,9 @@ xmlValidateOneAttribute(xmlValidCtxtPtr
|
|
attr->name, elem->name, NULL);
|
|
return(0);
|
|
}
|
|
- if (attr->atype == XML_ATTRIBUTE_ID)
|
|
+ if (XML_ATTR_GET_ATYPE(attr) == XML_ATTRIBUTE_ID)
|
|
xmlRemoveID(doc, attr);
|
|
- attr->atype = attrDecl->atype;
|
|
+ XML_ATTR_SET_ATYPE(attr, attrDecl->atype);
|
|
|
|
val = xmlValidateAttributeValueInternal(doc, attrDecl->atype, value);
|
|
if (val == 0) {
|
|
@@ -6318,7 +6318,7 @@ xmlValidateRef(xmlRefPtr ref, xmlValidCt
|
|
while (IS_BLANK_CH(*cur)) cur++;
|
|
}
|
|
xmlFree(dup);
|
|
- } else if (attr->atype == XML_ATTRIBUTE_IDREF) {
|
|
+ } else if (XML_ATTR_GET_ATYPE(attr) == XML_ATTRIBUTE_IDREF) {
|
|
id = xmlGetID(ctxt->doc, name);
|
|
if (id == NULL) {
|
|
xmlErrValidNode(ctxt, attr->parent, XML_DTD_UNKNOWN_ID,
|
|
@@ -6326,7 +6326,7 @@ xmlValidateRef(xmlRefPtr ref, xmlValidCt
|
|
attr->name, name, NULL);
|
|
ctxt->valid = 0;
|
|
}
|
|
- } else if (attr->atype == XML_ATTRIBUTE_IDREFS) {
|
|
+ } else if (XML_ATTR_GET_ATYPE(attr) == XML_ATTRIBUTE_IDREFS) {
|
|
xmlChar *dup, *str = NULL, *cur, save;
|
|
|
|
dup = xmlStrdup(name);
|
|
Index: libxml2-2.14.5/xmlreader.c
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/xmlreader.c
|
|
+++ libxml2-2.14.5/xmlreader.c
|
|
@@ -667,7 +667,7 @@ xmlTextReaderStartElement(void *ctx, con
|
|
if ((ctxt->node != NULL) && (ctxt->input != NULL) &&
|
|
(ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') &&
|
|
(ctxt->input->cur[1] == '>'))
|
|
- ctxt->node->extra = NODE_IS_EMPTY;
|
|
+ XML_NODE_SET_EXTRA(ctxt->node, NODE_IS_EMPTY);
|
|
}
|
|
if (reader != NULL)
|
|
reader->state = XML_TEXTREADER_ELEMENT;
|
|
@@ -726,7 +726,7 @@ xmlTextReaderStartElementNs(void *ctx,
|
|
if ((ctxt->node != NULL) && (ctxt->input != NULL) &&
|
|
(ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') &&
|
|
(ctxt->input->cur[1] == '>'))
|
|
- ctxt->node->extra = NODE_IS_EMPTY;
|
|
+ XML_NODE_SET_EXTRA(ctxt->node, NODE_IS_EMPTY);
|
|
}
|
|
if (reader != NULL)
|
|
reader->state = XML_TEXTREADER_ELEMENT;
|
|
@@ -1128,7 +1128,7 @@ skip_children:
|
|
xmlNodePtr tmp;
|
|
if (reader->entNr == 0) {
|
|
while ((tmp = node->last) != NULL) {
|
|
- if ((tmp->extra & NODE_IS_PRESERVED) == 0) {
|
|
+ if ((XML_NODE_GET_EXTRA(tmp) & NODE_IS_PRESERVED) == 0) {
|
|
xmlUnlinkNode(tmp);
|
|
xmlTextReaderFreeNode(reader, tmp);
|
|
} else
|
|
@@ -1339,7 +1339,7 @@ get_next_node:
|
|
if ((oldstate == XML_TEXTREADER_ELEMENT) &&
|
|
(reader->node->type == XML_ELEMENT_NODE) &&
|
|
(reader->node->children == NULL) &&
|
|
- ((reader->node->extra & NODE_IS_EMPTY) == 0)
|
|
+ ((XML_NODE_GET_EXTRA(reader->node) & NODE_IS_EMPTY) == 0)
|
|
#ifdef LIBXML_XINCLUDE_ENABLED
|
|
&& (reader->in_xinclude <= 0)
|
|
#endif
|
|
@@ -1354,7 +1354,7 @@ get_next_node:
|
|
return(-1);
|
|
#endif /* LIBXML_REGEXP_ENABLED */
|
|
if ((reader->preserves > 0) &&
|
|
- (reader->node->extra & NODE_IS_SPRESERVED))
|
|
+ (XML_NODE_GET_EXTRA(reader->node) & NODE_IS_SPRESERVED))
|
|
reader->preserves--;
|
|
reader->node = reader->node->next;
|
|
reader->state = XML_TEXTREADER_ELEMENT;
|
|
@@ -1370,7 +1370,7 @@ get_next_node:
|
|
(reader->node->prev != NULL) &&
|
|
(reader->node->prev->type != XML_DTD_NODE)) {
|
|
xmlNodePtr tmp = reader->node->prev;
|
|
- if ((tmp->extra & NODE_IS_PRESERVED) == 0) {
|
|
+ if ((XML_NODE_GET_EXTRA(tmp) & NODE_IS_PRESERVED) == 0) {
|
|
if (oldnode == tmp)
|
|
oldnode = NULL;
|
|
xmlUnlinkNode(tmp);
|
|
@@ -1383,7 +1383,7 @@ get_next_node:
|
|
if ((oldstate == XML_TEXTREADER_ELEMENT) &&
|
|
(reader->node->type == XML_ELEMENT_NODE) &&
|
|
(reader->node->children == NULL) &&
|
|
- ((reader->node->extra & NODE_IS_EMPTY) == 0)) {;
|
|
+ ((XML_NODE_GET_EXTRA(reader->node) & NODE_IS_EMPTY) == 0)) {;
|
|
reader->state = XML_TEXTREADER_END;
|
|
goto node_found;
|
|
}
|
|
@@ -1395,7 +1395,7 @@ get_next_node:
|
|
}
|
|
#endif /* LIBXML_REGEXP_ENABLED */
|
|
if ((reader->preserves > 0) &&
|
|
- (reader->node->extra & NODE_IS_SPRESERVED))
|
|
+ (XML_NODE_GET_EXTRA(reader->node) & NODE_IS_SPRESERVED))
|
|
reader->preserves--;
|
|
reader->node = reader->node->parent;
|
|
if ((reader->node == NULL) ||
|
|
@@ -1422,7 +1422,7 @@ get_next_node:
|
|
#endif
|
|
(reader->entNr == 0) &&
|
|
(oldnode->type != XML_DTD_NODE) &&
|
|
- ((oldnode->extra & NODE_IS_PRESERVED) == 0)) {
|
|
+ ((XML_NODE_GET_EXTRA(oldnode) & NODE_IS_PRESERVED) == 0)) {
|
|
xmlUnlinkNode(oldnode);
|
|
xmlTextReaderFreeNode(reader, oldnode);
|
|
}
|
|
@@ -1435,7 +1435,7 @@ get_next_node:
|
|
#endif
|
|
(reader->entNr == 0) &&
|
|
(reader->node->last != NULL) &&
|
|
- ((reader->node->last->extra & NODE_IS_PRESERVED) == 0)) {
|
|
+ ((XML_NODE_GET_EXTRA(reader->node->last) & NODE_IS_PRESERVED) == 0)) {
|
|
xmlNodePtr tmp = reader->node->last;
|
|
xmlUnlinkNode(tmp);
|
|
xmlTextReaderFreeNode(reader, tmp);
|
|
@@ -1638,7 +1638,7 @@ xmlTextReaderNext(xmlTextReaderPtr reade
|
|
return(xmlTextReaderRead(reader));
|
|
if (reader->state == XML_TEXTREADER_END || reader->state == XML_TEXTREADER_BACKTRACK)
|
|
return(xmlTextReaderRead(reader));
|
|
- if (cur->extra & NODE_IS_EMPTY)
|
|
+ if (XML_NODE_GET_EXTRA(cur) & NODE_IS_EMPTY)
|
|
return(xmlTextReaderRead(reader));
|
|
do {
|
|
ret = xmlTextReaderRead(reader);
|
|
@@ -3094,7 +3094,7 @@ xmlTextReaderIsEmptyElement(xmlTextReade
|
|
if (reader->in_xinclude > 0)
|
|
return(1);
|
|
#endif
|
|
- return((reader->node->extra & NODE_IS_EMPTY) != 0);
|
|
+ return((XML_NODE_GET_EXTRA(reader->node) & NODE_IS_EMPTY) != 0);
|
|
}
|
|
|
|
/**
|
|
@@ -3962,15 +3962,15 @@ xmlTextReaderPreserve(xmlTextReaderPtr r
|
|
return(NULL);
|
|
|
|
if ((cur->type != XML_DOCUMENT_NODE) && (cur->type != XML_DTD_NODE)) {
|
|
- cur->extra |= NODE_IS_PRESERVED;
|
|
- cur->extra |= NODE_IS_SPRESERVED;
|
|
+ XML_NODE_ADD_EXTRA(cur, NODE_IS_PRESERVED);
|
|
+ XML_NODE_ADD_EXTRA(cur, NODE_IS_SPRESERVED);
|
|
}
|
|
reader->preserves++;
|
|
|
|
parent = cur->parent;;
|
|
while (parent != NULL) {
|
|
if (parent->type == XML_ELEMENT_NODE)
|
|
- parent->extra |= NODE_IS_PRESERVED;
|
|
+ XML_NODE_ADD_EXTRA(parent, NODE_IS_PRESERVED);
|
|
parent = parent->parent;
|
|
}
|
|
return(cur);
|
|
Index: libxml2-2.14.5/xmlschemas.c
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/xmlschemas.c
|
|
+++ libxml2-2.14.5/xmlschemas.c
|
|
@@ -5857,7 +5857,7 @@ xmlSchemaPValAttrNodeID(xmlSchemaParserC
|
|
/*
|
|
* NOTE: the IDness might have already be declared in the DTD
|
|
*/
|
|
- if (attr->atype != XML_ATTRIBUTE_ID) {
|
|
+ if (XML_ATTR_GET_ATYPE(attr) != XML_ATTRIBUTE_ID) {
|
|
xmlChar *strip;
|
|
int res;
|
|
|
|
Index: libxml2-2.14.5/xmlschemastypes.c
|
|
===================================================================
|
|
--- libxml2-2.14.5.orig/xmlschemastypes.c
|
|
+++ libxml2-2.14.5/xmlschemastypes.c
|
|
@@ -3084,7 +3084,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr
|
|
/*
|
|
* NOTE: the IDness might have already be declared in the DTD
|
|
*/
|
|
- if (attr->atype != XML_ATTRIBUTE_ID) {
|
|
+ if (XML_ATTR_GET_ATYPE(attr) != XML_ATTRIBUTE_ID) {
|
|
xmlChar *strip;
|
|
int res;
|
|
|
|
@@ -3122,7 +3122,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr
|
|
xmlFree(strip);
|
|
} else
|
|
xmlAddRef(NULL, node->doc, value, attr);
|
|
- attr->atype = XML_ATTRIBUTE_IDREF;
|
|
+ XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_IDREF);
|
|
}
|
|
goto done;
|
|
case XML_SCHEMAS_IDREFS:
|
|
@@ -3136,7 +3136,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr
|
|
(node->type == XML_ATTRIBUTE_NODE)) {
|
|
xmlAttrPtr attr = (xmlAttrPtr) node;
|
|
|
|
- attr->atype = XML_ATTRIBUTE_IDREFS;
|
|
+ XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_IDREFS);
|
|
}
|
|
goto done;
|
|
case XML_SCHEMAS_ENTITY:{
|
|
@@ -3167,7 +3167,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr
|
|
(node->type == XML_ATTRIBUTE_NODE)) {
|
|
xmlAttrPtr attr = (xmlAttrPtr) node;
|
|
|
|
- attr->atype = XML_ATTRIBUTE_ENTITY;
|
|
+ XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_ENTITY);
|
|
}
|
|
goto done;
|
|
}
|
|
@@ -3184,7 +3184,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr
|
|
(node->type == XML_ATTRIBUTE_NODE)) {
|
|
xmlAttrPtr attr = (xmlAttrPtr) node;
|
|
|
|
- attr->atype = XML_ATTRIBUTE_ENTITIES;
|
|
+ XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_ENTITIES);
|
|
}
|
|
goto done;
|
|
case XML_SCHEMAS_NOTATION:{
|