diff options
| author | Hitendra Prajapati <hprajapati@mvista.com> | 2025-12-08 11:28:55 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-12-17 08:48:37 -0800 |
| commit | cc239ca412852bfde89bbaa5b3b6be96524bceb6 (patch) | |
| tree | 3f6d010babaa627622087c97c462b16707ce306b | |
| parent | 0549c04c9f56b131256171caa43fbaba3a0251d1 (diff) | |
| download | poky-cc239ca412852bfde89bbaa5b3b6be96524bceb6.tar.gz | |
libxml2: Security fix for CVE-2025-7425
CVE-2025-7425
libxslt: heap-use-after-free in xmlFreeID caused by `atype` corruption
Origin: https://launchpad.net/ubuntu/+source/libxml2/2.9.14+dfsg-1.3ubuntu3.6
Ref : https://security-tracker.debian.org/tracker/CVE-2025-7425
Upstream-Status: Backport from https://gitlab.gnome.org/GNOME/libxslt/-/issues/140
(From OE-Core rev: 315882f25ac3c5e5d210557fd863b3a0fff28850)
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-core/libxml/libxml2/CVE-2025-7425.patch | 802 | ||||
| -rw-r--r-- | meta/recipes-core/libxml/libxml2_2.12.10.bb | 1 |
2 files changed, 803 insertions, 0 deletions
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2025-7425.patch b/meta/recipes-core/libxml/libxml2/CVE-2025-7425.patch new file mode 100644 index 0000000000..870ada53b8 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/CVE-2025-7425.patch | |||
| @@ -0,0 +1,802 @@ | |||
| 1 | From 87786d6200ae1f5ac98d21f04d451e17ff25a216 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: David Kilzer <ddkilzer@apple.com> | ||
| 3 | Reviewed-By: Aron Xu <aron@debian.org> | ||
| 4 | Date: Mon, 23 Jun 2025 14:41:56 -0700 | ||
| 5 | Subject: [PATCH] libxslt: heap-use-after-free in xmlFreeID caused by `atype` | ||
| 6 | corruption | ||
| 7 | |||
| 8 | * include/libxml/tree.h: | ||
| 9 | (XML_ATTR_CLEAR_ATYPE): Add. | ||
| 10 | (XML_ATTR_GET_ATYPE): Add. | ||
| 11 | (XML_ATTR_SET_ATYPE): Add. | ||
| 12 | (XML_NODE_ADD_EXTRA): Add. | ||
| 13 | (XML_NODE_CLEAR_EXTRA): Add. | ||
| 14 | (XML_NODE_GET_EXTRA): Add. | ||
| 15 | (XML_NODE_SET_EXTRA): Add. | ||
| 16 | (XML_DOC_ADD_PROPERTIES): Add. | ||
| 17 | (XML_DOC_CLEAR_PROPERTIES): Add. | ||
| 18 | (XML_DOC_GET_PROPERTIES): Add. | ||
| 19 | (XML_DOC_SET_PROPERTIES): Add. | ||
| 20 | - Add macros for accessing fields with upper bits that may be set by | ||
| 21 | libxslt. | ||
| 22 | |||
| 23 | * HTMLparser.c: | ||
| 24 | (htmlNewDocNoDtD): | ||
| 25 | * SAX2.c: | ||
| 26 | (xmlSAX2StartDocument): | ||
| 27 | (xmlSAX2EndDocument): | ||
| 28 | * parser.c: | ||
| 29 | (xmlParseEntityDecl): | ||
| 30 | (xmlParseExternalSubset): | ||
| 31 | (xmlParseReference): | ||
| 32 | (xmlCtxtParseDtd): | ||
| 33 | * runxmlconf.c: | ||
| 34 | (xmlconfTestInvalid): | ||
| 35 | (xmlconfTestValid): | ||
| 36 | * tree.c: | ||
| 37 | (xmlNewDoc): | ||
| 38 | (xmlFreeProp): | ||
| 39 | (xmlNodeSetDoc): | ||
| 40 | (xmlSetNsProp): | ||
| 41 | (xmlDOMWrapAdoptBranch): | ||
| 42 | * valid.c: | ||
| 43 | (xmlFreeID): | ||
| 44 | (xmlAddIDInternal): | ||
| 45 | (xmlValidateAttributeValueInternal): | ||
| 46 | (xmlValidateOneAttribute): | ||
| 47 | (xmlValidateRef): | ||
| 48 | * xmlreader.c: | ||
| 49 | (xmlTextReaderStartElement): | ||
| 50 | (xmlTextReaderStartElementNs): | ||
| 51 | (xmlTextReaderValidateEntity): | ||
| 52 | (xmlTextReaderRead): | ||
| 53 | (xmlTextReaderNext): | ||
| 54 | (xmlTextReaderIsEmptyElement): | ||
| 55 | (xmlTextReaderPreserve): | ||
| 56 | * xmlschemas.c: | ||
| 57 | (xmlSchemaPValAttrNodeID): | ||
| 58 | * xmlschemastypes.c: | ||
| 59 | (xmlSchemaValAtomicType): | ||
| 60 | - Adopt macros by renaming the struct fields, recompiling and fixing | ||
| 61 | compiler failures, then changing the struct field names back. | ||
| 62 | Origin: https://launchpad.net/ubuntu/+source/libxml2/2.9.14+dfsg-1.3ubuntu3.6 | ||
| 63 | Ref : https://security-tracker.debian.org/tracker/CVE-2025-7425 | ||
| 64 | |||
| 65 | CVE: CVE-2025-7425 | ||
| 66 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxslt/-/issues/140] | ||
| 67 | Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> | ||
| 68 | --- | ||
| 69 | HTMLparser.c | 1 + | ||
| 70 | SAX2.c | 6 ++-- | ||
| 71 | include/libxml/tree.h | 14 ++++++++- | ||
| 72 | parser.c | 8 ++--- | ||
| 73 | runxmlconf.c | 4 +-- | ||
| 74 | tree.c | 20 ++++++------- | ||
| 75 | valid.c | 68 +++++++++++++++++++++---------------------- | ||
| 76 | xmlreader.c | 30 +++++++++---------- | ||
| 77 | xmlschemas.c | 4 +-- | ||
| 78 | xmlschemastypes.c | 12 ++++---- | ||
| 79 | 10 files changed, 90 insertions(+), 77 deletions(-) | ||
| 80 | |||
| 81 | diff --git a/HTMLparser.c b/HTMLparser.c | ||
| 82 | index ea6a4f2..9f439d6 100644 | ||
| 83 | --- a/HTMLparser.c | ||
| 84 | +++ b/HTMLparser.c | ||
| 85 | @@ -2459,6 +2459,7 @@ htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) { | ||
| 86 | cur->refs = NULL; | ||
| 87 | cur->_private = NULL; | ||
| 88 | cur->charset = XML_CHAR_ENCODING_UTF8; | ||
| 89 | + XML_DOC_SET_PROPERTIES(cur, XML_DOC_HTML | XML_DOC_USERBUILT); | ||
| 90 | cur->properties = XML_DOC_HTML | XML_DOC_USERBUILT; | ||
| 91 | if ((ExternalID != NULL) || | ||
| 92 | (URI != NULL)) | ||
| 93 | diff --git a/SAX2.c b/SAX2.c | ||
| 94 | index bb72e16..08786a3 100644 | ||
| 95 | --- a/SAX2.c | ||
| 96 | +++ b/SAX2.c | ||
| 97 | @@ -899,7 +899,7 @@ xmlSAX2StartDocument(void *ctx) | ||
| 98 | xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); | ||
| 99 | return; | ||
| 100 | } | ||
| 101 | - ctxt->myDoc->properties = XML_DOC_HTML; | ||
| 102 | + XML_DOC_SET_PROPERTIES(ctxt->myDoc, XML_DOC_HTML); | ||
| 103 | ctxt->myDoc->parseFlags = ctxt->options; | ||
| 104 | #else | ||
| 105 | xmlGenericError(xmlGenericErrorContext, | ||
| 106 | @@ -912,9 +912,9 @@ xmlSAX2StartDocument(void *ctx) | ||
| 107 | } else { | ||
| 108 | doc = ctxt->myDoc = xmlNewDoc(ctxt->version); | ||
| 109 | if (doc != NULL) { | ||
| 110 | - doc->properties = 0; | ||
| 111 | + XML_DOC_CLEAR_PROPERTIES(doc); | ||
| 112 | if (ctxt->options & XML_PARSE_OLD10) | ||
| 113 | - doc->properties |= XML_DOC_OLD10; | ||
| 114 | + XML_DOC_ADD_PROPERTIES(doc, XML_DOC_OLD10); | ||
| 115 | doc->parseFlags = ctxt->options; | ||
| 116 | doc->standalone = ctxt->standalone; | ||
| 117 | } else { | ||
| 118 | diff --git a/include/libxml/tree.h b/include/libxml/tree.h | ||
| 119 | index a90a174..a013232 100644 | ||
| 120 | --- a/include/libxml/tree.h | ||
| 121 | +++ b/include/libxml/tree.h | ||
| 122 | @@ -370,7 +370,6 @@ struct _xmlElement { | ||
| 123 | #endif | ||
| 124 | }; | ||
| 125 | |||
| 126 | - | ||
| 127 | /** | ||
| 128 | * XML_LOCAL_NAMESPACE: | ||
| 129 | * | ||
| 130 | @@ -451,6 +450,10 @@ struct _xmlAttr { | ||
| 131 | void *psvi; /* for type/PSVI information */ | ||
| 132 | }; | ||
| 133 | |||
| 134 | +#define XML_ATTR_CLEAR_ATYPE(attr) (((attr)->atype) = 0) | ||
| 135 | +#define XML_ATTR_GET_ATYPE(attr) (((attr)->atype) & ~(15U << 27)) | ||
| 136 | +#define XML_ATTR_SET_ATYPE(attr, type) ((attr)->atype = ((((attr)->atype) & (15U << 27)) | ((type) & ~(15U << 27)))) | ||
| 137 | + | ||
| 138 | /** | ||
| 139 | * xmlID: | ||
| 140 | * | ||
| 141 | @@ -512,6 +515,11 @@ struct _xmlNode { | ||
| 142 | unsigned short extra; /* extra data for XPath/XSLT */ | ||
| 143 | }; | ||
| 144 | |||
| 145 | +#define XML_NODE_ADD_EXTRA(node, type) ((node)->extra |= ((type) & ~(15U << 12))) | ||
| 146 | +#define XML_NODE_CLEAR_EXTRA(node) (((node)->extra) = 0) | ||
| 147 | +#define XML_NODE_GET_EXTRA(node) (((node)->extra) & ~(15U << 12)) | ||
| 148 | +#define XML_NODE_SET_EXTRA(node, type) ((node)->extra = ((((node)->extra) & (15U << 12)) | ((type) & ~(15U << 12)))) | ||
| 149 | + | ||
| 150 | /** | ||
| 151 | * XML_GET_CONTENT: | ||
| 152 | * | ||
| 153 | @@ -589,6 +597,10 @@ struct _xmlDoc { | ||
| 154 | set at the end of parsing */ | ||
| 155 | }; | ||
| 156 | |||
| 157 | +#define XML_DOC_ADD_PROPERTIES(doc, type) ((doc)->properties |= ((type) & ~(15U << 27))) | ||
| 158 | +#define XML_DOC_CLEAR_PROPERTIES(doc) (((doc)->properties) = 0) | ||
| 159 | +#define XML_DOC_GET_PROPERTIES(doc) (((doc)->properties) & ~(15U << 27)) | ||
| 160 | +#define XML_DOC_SET_PROPERTIES(doc, type) ((doc)->properties = ((((doc)->properties) & (15U << 27)) | ((type) & ~(15U << 27)))) | ||
| 161 | |||
| 162 | typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; | ||
| 163 | typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; | ||
| 164 | diff --git a/parser.c b/parser.c | ||
| 165 | index 6ab4bfe..19ae310 100644 | ||
| 166 | --- a/parser.c | ||
| 167 | +++ b/parser.c | ||
| 168 | @@ -5663,7 +5663,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { | ||
| 169 | xmlErrMemory(ctxt, "New Doc failed"); | ||
| 170 | goto done; | ||
| 171 | } | ||
| 172 | - ctxt->myDoc->properties = XML_DOC_INTERNAL; | ||
| 173 | + XML_DOC_SET_PROPERTIES(ctxt->myDoc, XML_DOC_INTERNAL); | ||
| 174 | } | ||
| 175 | if (ctxt->myDoc->intSubset == NULL) | ||
| 176 | ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc, | ||
| 177 | @@ -5734,7 +5734,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { | ||
| 178 | xmlErrMemory(ctxt, "New Doc failed"); | ||
| 179 | goto done; | ||
| 180 | } | ||
| 181 | - ctxt->myDoc->properties = XML_DOC_INTERNAL; | ||
| 182 | + XML_DOC_SET_PROPERTIES(ctxt->myDoc, XML_DOC_INTERNAL); | ||
| 183 | } | ||
| 184 | |||
| 185 | if (ctxt->myDoc->intSubset == NULL) | ||
| 186 | @@ -7179,7 +7179,7 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, | ||
| 187 | xmlErrMemory(ctxt, "New Doc failed"); | ||
| 188 | return; | ||
| 189 | } | ||
| 190 | - ctxt->myDoc->properties = XML_DOC_INTERNAL; | ||
| 191 | + XML_DOC_SET_PROPERTIES(ctxt->myDoc, XML_DOC_INTERNAL); | ||
| 192 | } | ||
| 193 | if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL)) | ||
| 194 | xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID); | ||
| 195 | @@ -7580,7 +7580,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { | ||
| 196 | (nw != NULL) && | ||
| 197 | (nw->type == XML_ELEMENT_NODE) && | ||
| 198 | (nw->children == NULL)) | ||
| 199 | - nw->extra = 1; | ||
| 200 | + XML_NODE_SET_EXTRA(nw, 1); | ||
| 201 | |||
| 202 | break; | ||
| 203 | } | ||
| 204 | diff --git a/runxmlconf.c b/runxmlconf.c | ||
| 205 | index b5c3fd8..75fcfd6 100644 | ||
| 206 | --- a/runxmlconf.c | ||
| 207 | +++ b/runxmlconf.c | ||
| 208 | @@ -190,7 +190,7 @@ xmlconfTestInvalid(const char *id, const char *filename, int options) { | ||
| 209 | id, filename); | ||
| 210 | } else { | ||
| 211 | /* invalidity should be reported both in the context and in the document */ | ||
| 212 | - if ((ctxt->valid != 0) || (doc->properties & XML_DOC_DTDVALID)) { | ||
| 213 | + if ((ctxt->valid != 0) || (XML_DOC_GET_PROPERTIES(doc) & XML_DOC_DTDVALID)) { | ||
| 214 | test_log("test %s : %s failed to detect invalid document\n", | ||
| 215 | id, filename); | ||
| 216 | nb_errors++; | ||
| 217 | @@ -222,7 +222,7 @@ xmlconfTestValid(const char *id, const char *filename, int options) { | ||
| 218 | ret = 0; | ||
| 219 | } else { | ||
| 220 | /* validity should be reported both in the context and in the document */ | ||
| 221 | - if ((ctxt->valid == 0) || ((doc->properties & XML_DOC_DTDVALID) == 0)) { | ||
| 222 | + if ((ctxt->valid == 0) || ((XML_DOC_GET_PROPERTIES(doc) & XML_DOC_DTDVALID) == 0)) { | ||
| 223 | test_log("test %s : %s failed to validate a valid document\n", | ||
| 224 | id, filename); | ||
| 225 | nb_errors++; | ||
| 226 | diff --git a/tree.c b/tree.c | ||
| 227 | index f89e3cd..772ca62 100644 | ||
| 228 | --- a/tree.c | ||
| 229 | +++ b/tree.c | ||
| 230 | @@ -1160,7 +1160,7 @@ xmlNewDoc(const xmlChar *version) { | ||
| 231 | cur->compression = -1; /* not initialized */ | ||
| 232 | cur->doc = cur; | ||
| 233 | cur->parseFlags = 0; | ||
| 234 | - cur->properties = XML_DOC_USERBUILT; | ||
| 235 | + XML_DOC_SET_PROPERTIES(cur, XML_DOC_USERBUILT); | ||
| 236 | /* | ||
| 237 | * The in memory encoding is always UTF8 | ||
| 238 | * This field will never change and would | ||
| 239 | @@ -2077,7 +2077,7 @@ xmlFreeProp(xmlAttrPtr cur) { | ||
| 240 | xmlDeregisterNodeDefaultValue((xmlNodePtr)cur); | ||
| 241 | |||
| 242 | /* Check for ID removal -> leading to invalid references ! */ | ||
| 243 | - if ((cur->doc != NULL) && (cur->atype == XML_ATTRIBUTE_ID)) { | ||
| 244 | + if ((cur->doc != NULL) && (XML_ATTR_GET_ATYPE(cur) == XML_ATTRIBUTE_ID)) { | ||
| 245 | xmlRemoveID(cur->doc, cur); | ||
| 246 | } | ||
| 247 | if (cur->children != NULL) xmlFreeNodeList(cur->children); | ||
| 248 | @@ -2794,7 +2794,7 @@ xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) { | ||
| 249 | if(tree->type == XML_ELEMENT_NODE) { | ||
| 250 | prop = tree->properties; | ||
| 251 | while (prop != NULL) { | ||
| 252 | - if (prop->atype == XML_ATTRIBUTE_ID) { | ||
| 253 | + if (XML_ATTR_GET_ATYPE(prop) == XML_ATTRIBUTE_ID) { | ||
| 254 | xmlRemoveID(tree->doc, prop); | ||
| 255 | } | ||
| 256 | |||
| 257 | @@ -6836,9 +6836,9 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, | ||
| 258 | /* | ||
| 259 | * Modify the attribute's value. | ||
| 260 | */ | ||
| 261 | - if (prop->atype == XML_ATTRIBUTE_ID) { | ||
| 262 | + if (XML_ATTR_GET_ATYPE(prop) == XML_ATTRIBUTE_ID) { | ||
| 263 | xmlRemoveID(node->doc, prop); | ||
| 264 | - prop->atype = XML_ATTRIBUTE_ID; | ||
| 265 | + XML_ATTR_SET_ATYPE(prop, XML_ATTRIBUTE_ID); | ||
| 266 | } | ||
| 267 | if (prop->children != NULL) | ||
| 268 | xmlFreeNodeList(prop->children); | ||
| 269 | @@ -6858,7 +6858,7 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, | ||
| 270 | tmp = tmp->next; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | - if (prop->atype == XML_ATTRIBUTE_ID) | ||
| 274 | + if (XML_ATTR_GET_ATYPE(prop) == XML_ATTRIBUTE_ID) | ||
| 275 | xmlAddID(NULL, node->doc, value, prop); | ||
| 276 | return(prop); | ||
| 277 | } | ||
| 278 | @@ -9077,7 +9077,7 @@ ns_end: | ||
| 279 | if (cur->type == XML_ELEMENT_NODE) { | ||
| 280 | cur->psvi = NULL; | ||
| 281 | cur->line = 0; | ||
| 282 | - cur->extra = 0; | ||
| 283 | + XML_NODE_CLEAR_EXTRA(cur); | ||
| 284 | /* | ||
| 285 | * Walk attributes. | ||
| 286 | */ | ||
| 287 | @@ -9093,11 +9093,11 @@ ns_end: | ||
| 288 | * Attributes. | ||
| 289 | */ | ||
| 290 | if ((sourceDoc != NULL) && | ||
| 291 | - (((xmlAttrPtr) cur)->atype == XML_ATTRIBUTE_ID)) | ||
| 292 | + (XML_ATTR_GET_ATYPE((xmlAttrPtr) cur) == XML_ATTRIBUTE_ID)) | ||
| 293 | { | ||
| 294 | xmlRemoveID(sourceDoc, (xmlAttrPtr) cur); | ||
| 295 | } | ||
| 296 | - ((xmlAttrPtr) cur)->atype = 0; | ||
| 297 | + XML_ATTR_CLEAR_ATYPE((xmlAttrPtr) cur); | ||
| 298 | ((xmlAttrPtr) cur)->psvi = NULL; | ||
| 299 | } | ||
| 300 | break; | ||
| 301 | @@ -9818,7 +9818,7 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, | ||
| 302 | } | ||
| 303 | |||
| 304 | XML_TREE_ADOPT_STR(attr->name); | ||
| 305 | - attr->atype = 0; | ||
| 306 | + XML_ATTR_CLEAR_ATYPE(attr); | ||
| 307 | attr->psvi = NULL; | ||
| 308 | /* | ||
| 309 | * Walk content. | ||
| 310 | diff --git a/valid.c b/valid.c | ||
| 311 | index abefdc5..ae4bb82 100644 | ||
| 312 | --- a/valid.c | ||
| 313 | +++ b/valid.c | ||
| 314 | @@ -1736,7 +1736,7 @@ xmlScanIDAttributeDecl(xmlValidCtxtPtr ctxt, xmlElementPtr elem, int err) { | ||
| 315 | if (elem == NULL) return(0); | ||
| 316 | cur = elem->attributes; | ||
| 317 | while (cur != NULL) { | ||
| 318 | - if (cur->atype == XML_ATTRIBUTE_ID) { | ||
| 319 | + if (XML_ATTR_GET_ATYPE(cur) == XML_ATTRIBUTE_ID) { | ||
| 320 | ret ++; | ||
| 321 | if ((ret > 1) && (err)) | ||
| 322 | xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_MULTIPLE_ID, | ||
| 323 | @@ -2109,7 +2109,7 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) { | ||
| 324 | xmlBufferWriteChar(buf, ":"); | ||
| 325 | } | ||
| 326 | xmlBufferWriteCHAR(buf, attr->name); | ||
| 327 | - switch (attr->atype) { | ||
| 328 | + switch (XML_ATTR_GET_ATYPE(attr)) { | ||
| 329 | case XML_ATTRIBUTE_CDATA: | ||
| 330 | xmlBufferWriteChar(buf, " CDATA"); | ||
| 331 | break; | ||
| 332 | @@ -2582,7 +2582,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, | ||
| 333 | return(NULL); | ||
| 334 | } | ||
| 335 | if (attr != NULL) | ||
| 336 | - attr->atype = XML_ATTRIBUTE_ID; | ||
| 337 | + XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_ID); | ||
| 338 | return(ret); | ||
| 339 | } | ||
| 340 | |||
| 341 | @@ -2661,7 +2661,7 @@ xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { | ||
| 342 | if ((fullelemname != felem) && (fullelemname != elem->name)) | ||
| 343 | xmlFree(fullelemname); | ||
| 344 | |||
| 345 | - if ((attrDecl != NULL) && (attrDecl->atype == XML_ATTRIBUTE_ID)) | ||
| 346 | + if ((attrDecl != NULL) && (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_ID)) | ||
| 347 | return(1); | ||
| 348 | } | ||
| 349 | return(0); | ||
| 350 | @@ -2702,7 +2702,7 @@ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { | ||
| 351 | |||
| 352 | xmlHashRemoveEntry(table, ID, xmlFreeIDTableEntry); | ||
| 353 | xmlFree(ID); | ||
| 354 | - attr->atype = 0; | ||
| 355 | + XML_ATTR_CLEAR_ATYPE(attr); | ||
| 356 | return(0); | ||
| 357 | } | ||
| 358 | |||
| 359 | @@ -2987,8 +2987,8 @@ xmlIsRef(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { | ||
| 360 | elem->name, attr->name); | ||
| 361 | |||
| 362 | if ((attrDecl != NULL) && | ||
| 363 | - (attrDecl->atype == XML_ATTRIBUTE_IDREF || | ||
| 364 | - attrDecl->atype == XML_ATTRIBUTE_IDREFS)) | ||
| 365 | + (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_IDREF || | ||
| 366 | + XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_IDREFS)) | ||
| 367 | return(1); | ||
| 368 | } | ||
| 369 | return(0); | ||
| 370 | @@ -3372,7 +3372,7 @@ xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name) { | ||
| 371 | |||
| 372 | static int | ||
| 373 | xmlIsDocNameStartChar(xmlDocPtr doc, int c) { | ||
| 374 | - if ((doc == NULL) || (doc->properties & XML_DOC_OLD10) == 0) { | ||
| 375 | + if ((doc == NULL) || (XML_DOC_GET_PROPERTIES(doc) & XML_DOC_OLD10) == 0) { | ||
| 376 | /* | ||
| 377 | * Use the new checks of production [4] [4a] amd [5] of the | ||
| 378 | * Update 5 of XML-1.0 | ||
| 379 | @@ -3402,7 +3402,7 @@ xmlIsDocNameStartChar(xmlDocPtr doc, int c) { | ||
| 380 | |||
| 381 | static int | ||
| 382 | xmlIsDocNameChar(xmlDocPtr doc, int c) { | ||
| 383 | - if ((doc == NULL) || (doc->properties & XML_DOC_OLD10) == 0) { | ||
| 384 | + if ((doc == NULL) || (XML_DOC_GET_PROPERTIES(doc) & XML_DOC_OLD10) == 0) { | ||
| 385 | /* | ||
| 386 | * Use the new checks of production [4] [4a] amd [5] of the | ||
| 387 | * Update 5 of XML-1.0 | ||
| 388 | @@ -3952,7 +3952,7 @@ xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc, | ||
| 389 | |||
| 390 | if (attrDecl == NULL) | ||
| 391 | return(NULL); | ||
| 392 | - if (attrDecl->atype == XML_ATTRIBUTE_CDATA) | ||
| 393 | + if (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_CDATA) | ||
| 394 | return(NULL); | ||
| 395 | |||
| 396 | ret = xmlStrdup(value); | ||
| 397 | @@ -4014,7 +4014,7 @@ xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem, | ||
| 398 | |||
| 399 | if (attrDecl == NULL) | ||
| 400 | return(NULL); | ||
| 401 | - if (attrDecl->atype == XML_ATTRIBUTE_CDATA) | ||
| 402 | + if (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_CDATA) | ||
| 403 | return(NULL); | ||
| 404 | |||
| 405 | ret = xmlStrdup(value); | ||
| 406 | @@ -4029,7 +4029,7 @@ xmlValidateAttributeIdCallback(void *payload, void *data, | ||
| 407 | const xmlChar *name ATTRIBUTE_UNUSED) { | ||
| 408 | xmlAttributePtr attr = (xmlAttributePtr) payload; | ||
| 409 | int *count = (int *) data; | ||
| 410 | - if (attr->atype == XML_ATTRIBUTE_ID) (*count)++; | ||
| 411 | + if (XML_ATTR_GET_ATYPE(attr) == XML_ATTRIBUTE_ID) (*count)++; | ||
| 412 | } | ||
| 413 | |||
| 414 | /** | ||
| 415 | @@ -4061,7 +4061,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, | ||
| 416 | /* Attribute Default Legal */ | ||
| 417 | /* Enumeration */ | ||
| 418 | if (attr->defaultValue != NULL) { | ||
| 419 | - val = xmlValidateAttributeValueInternal(doc, attr->atype, | ||
| 420 | + val = xmlValidateAttributeValueInternal(doc, XML_ATTR_GET_ATYPE(attr), | ||
| 421 | attr->defaultValue); | ||
| 422 | if (val == 0) { | ||
| 423 | xmlErrValidNode(ctxt, (xmlNodePtr) attr, XML_DTD_ATTRIBUTE_DEFAULT, | ||
| 424 | @@ -4072,7 +4072,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, | ||
| 425 | } | ||
| 426 | |||
| 427 | /* ID Attribute Default */ | ||
| 428 | - if ((attr->atype == XML_ATTRIBUTE_ID)&& | ||
| 429 | + if ((XML_ATTR_GET_ATYPE(attr) == XML_ATTRIBUTE_ID)&& | ||
| 430 | (attr->def != XML_ATTRIBUTE_IMPLIED) && | ||
| 431 | (attr->def != XML_ATTRIBUTE_REQUIRED)) { | ||
| 432 | xmlErrValidNode(ctxt, (xmlNodePtr) attr, XML_DTD_ID_FIXED, | ||
| 433 | @@ -4082,7 +4082,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, | ||
| 434 | } | ||
| 435 | |||
| 436 | /* One ID per Element Type */ | ||
| 437 | - if (attr->atype == XML_ATTRIBUTE_ID) { | ||
| 438 | + if (XML_ATTR_GET_ATYPE(attr) == XML_ATTRIBUTE_ID) { | ||
| 439 | int nbId; | ||
| 440 | |||
| 441 | /* the trick is that we parse DtD as their own internal subset */ | ||
| 442 | @@ -4341,9 +4341,9 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, | ||
| 443 | attr->name, elem->name, NULL); | ||
| 444 | return(0); | ||
| 445 | } | ||
| 446 | - attr->atype = attrDecl->atype; | ||
| 447 | + XML_ATTR_SET_ATYPE(attr, attrDecl->atype); | ||
| 448 | |||
| 449 | - val = xmlValidateAttributeValueInternal(doc, attrDecl->atype, value); | ||
| 450 | + val = xmlValidateAttributeValueInternal(doc, XML_ATTR_GET_ATYPE(attrDecl), value); | ||
| 451 | if (val == 0) { | ||
| 452 | xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_VALUE, | ||
| 453 | "Syntax of value for attribute %s of %s is not valid\n", | ||
| 454 | @@ -4362,19 +4362,19 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, | ||
| 455 | } | ||
| 456 | |||
| 457 | /* Validity Constraint: ID uniqueness */ | ||
| 458 | - if (attrDecl->atype == XML_ATTRIBUTE_ID) { | ||
| 459 | + if (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_ID) { | ||
| 460 | if (xmlAddID(ctxt, doc, value, attr) == NULL) | ||
| 461 | ret = 0; | ||
| 462 | } | ||
| 463 | |||
| 464 | - if ((attrDecl->atype == XML_ATTRIBUTE_IDREF) || | ||
| 465 | - (attrDecl->atype == XML_ATTRIBUTE_IDREFS)) { | ||
| 466 | + if ((XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_IDREF) || | ||
| 467 | + (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_IDREFS)) { | ||
| 468 | if (xmlAddRef(ctxt, doc, value, attr) == NULL) | ||
| 469 | ret = 0; | ||
| 470 | } | ||
| 471 | |||
| 472 | /* Validity Constraint: Notation Attributes */ | ||
| 473 | - if (attrDecl->atype == XML_ATTRIBUTE_NOTATION) { | ||
| 474 | + if (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_NOTATION) { | ||
| 475 | xmlEnumerationPtr tree = attrDecl->tree; | ||
| 476 | xmlNotationPtr nota; | ||
| 477 | |||
| 478 | @@ -4404,7 +4404,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, | ||
| 479 | } | ||
| 480 | |||
| 481 | /* Validity Constraint: Enumeration */ | ||
| 482 | - if (attrDecl->atype == XML_ATTRIBUTE_ENUMERATION) { | ||
| 483 | + if (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_ENUMERATION) { | ||
| 484 | xmlEnumerationPtr tree = attrDecl->tree; | ||
| 485 | while (tree != NULL) { | ||
| 486 | if (xmlStrEqual(tree->name, value)) break; | ||
| 487 | @@ -4429,7 +4429,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, | ||
| 488 | |||
| 489 | /* Extra check for the attribute value */ | ||
| 490 | ret &= xmlValidateAttributeValue2(ctxt, doc, attr->name, | ||
| 491 | - attrDecl->atype, value); | ||
| 492 | + XML_ATTR_GET_ATYPE(attrDecl), value); | ||
| 493 | |||
| 494 | return(ret); | ||
| 495 | } | ||
| 496 | @@ -4528,7 +4528,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { | ||
| 497 | return(0); | ||
| 498 | } | ||
| 499 | |||
| 500 | - val = xmlValidateAttributeValueInternal(doc, attrDecl->atype, value); | ||
| 501 | + val = xmlValidateAttributeValueInternal(doc, XML_ATTR_GET_ATYPE(attrDecl), value); | ||
| 502 | if (val == 0) { | ||
| 503 | if (ns->prefix != NULL) { | ||
| 504 | xmlErrValidNode(ctxt, elem, XML_DTD_INVALID_DEFAULT, | ||
| 505 | @@ -4578,7 +4578,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { | ||
| 506 | #endif | ||
| 507 | |||
| 508 | /* Validity Constraint: Notation Attributes */ | ||
| 509 | - if (attrDecl->atype == XML_ATTRIBUTE_NOTATION) { | ||
| 510 | + if (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_NOTATION) { | ||
| 511 | xmlEnumerationPtr tree = attrDecl->tree; | ||
| 512 | xmlNotationPtr nota; | ||
| 513 | |||
| 514 | @@ -4620,7 +4620,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { | ||
| 515 | } | ||
| 516 | |||
| 517 | /* Validity Constraint: Enumeration */ | ||
| 518 | - if (attrDecl->atype == XML_ATTRIBUTE_ENUMERATION) { | ||
| 519 | + if (XML_ATTR_GET_ATYPE(attrDecl) == XML_ATTRIBUTE_ENUMERATION) { | ||
| 520 | xmlEnumerationPtr tree = attrDecl->tree; | ||
| 521 | while (tree != NULL) { | ||
| 522 | if (xmlStrEqual(tree->name, value)) break; | ||
| 523 | @@ -4658,10 +4658,10 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { | ||
| 524 | /* Extra check for the attribute value */ | ||
| 525 | if (ns->prefix != NULL) { | ||
| 526 | ret &= xmlValidateAttributeValue2(ctxt, doc, ns->prefix, | ||
| 527 | - attrDecl->atype, value); | ||
| 528 | + XML_ATTR_GET_ATYPE(attrDecl), value); | ||
| 529 | } else { | ||
| 530 | ret &= xmlValidateAttributeValue2(ctxt, doc, BAD_CAST "xmlns", | ||
| 531 | - attrDecl->atype, value); | ||
| 532 | + XML_ATTR_GET_ATYPE(attrDecl), value); | ||
| 533 | } | ||
| 534 | |||
| 535 | return(ret); | ||
| 536 | @@ -6375,7 +6375,7 @@ xmlValidateRef(xmlRefPtr ref, xmlValidCtxtPtr ctxt, | ||
| 537 | while (IS_BLANK_CH(*cur)) cur++; | ||
| 538 | } | ||
| 539 | xmlFree(dup); | ||
| 540 | - } else if (attr->atype == XML_ATTRIBUTE_IDREF) { | ||
| 541 | + } else if (XML_ATTR_GET_ATYPE(attr) == XML_ATTRIBUTE_IDREF) { | ||
| 542 | id = xmlGetID(ctxt->doc, name); | ||
| 543 | if (id == NULL) { | ||
| 544 | xmlErrValidNode(ctxt, attr->parent, XML_DTD_UNKNOWN_ID, | ||
| 545 | @@ -6383,7 +6383,7 @@ xmlValidateRef(xmlRefPtr ref, xmlValidCtxtPtr ctxt, | ||
| 546 | attr->name, name, NULL); | ||
| 547 | ctxt->valid = 0; | ||
| 548 | } | ||
| 549 | - } else if (attr->atype == XML_ATTRIBUTE_IDREFS) { | ||
| 550 | + } else if (XML_ATTR_GET_ATYPE(attr) == XML_ATTRIBUTE_IDREFS) { | ||
| 551 | xmlChar *dup, *str = NULL, *cur, save; | ||
| 552 | |||
| 553 | dup = xmlStrdup(name); | ||
| 554 | @@ -6583,7 +6583,7 @@ xmlValidateAttributeCallback(void *payload, void *data, | ||
| 555 | |||
| 556 | if (cur == NULL) | ||
| 557 | return; | ||
| 558 | - switch (cur->atype) { | ||
| 559 | + switch (XML_ATTR_GET_ATYPE(cur)) { | ||
| 560 | case XML_ATTRIBUTE_CDATA: | ||
| 561 | case XML_ATTRIBUTE_ID: | ||
| 562 | case XML_ATTRIBUTE_IDREF : | ||
| 563 | @@ -6598,7 +6598,7 @@ xmlValidateAttributeCallback(void *payload, void *data, | ||
| 564 | if (cur->defaultValue != NULL) { | ||
| 565 | |||
| 566 | ret = xmlValidateAttributeValue2(ctxt, ctxt->doc, cur->name, | ||
| 567 | - cur->atype, cur->defaultValue); | ||
| 568 | + XML_ATTR_GET_ATYPE(cur), cur->defaultValue); | ||
| 569 | if ((ret == 0) && (ctxt->valid == 1)) | ||
| 570 | ctxt->valid = 0; | ||
| 571 | } | ||
| 572 | @@ -6606,14 +6606,14 @@ xmlValidateAttributeCallback(void *payload, void *data, | ||
| 573 | xmlEnumerationPtr tree = cur->tree; | ||
| 574 | while (tree != NULL) { | ||
| 575 | ret = xmlValidateAttributeValue2(ctxt, ctxt->doc, | ||
| 576 | - cur->name, cur->atype, tree->name); | ||
| 577 | + cur->name, XML_ATTR_GET_ATYPE(cur), tree->name); | ||
| 578 | if ((ret == 0) && (ctxt->valid == 1)) | ||
| 579 | ctxt->valid = 0; | ||
| 580 | tree = tree->next; | ||
| 581 | } | ||
| 582 | } | ||
| 583 | } | ||
| 584 | - if (cur->atype == XML_ATTRIBUTE_NOTATION) { | ||
| 585 | + if (XML_ATTR_GET_ATYPE(cur) == XML_ATTRIBUTE_NOTATION) { | ||
| 586 | doc = cur->doc; | ||
| 587 | if (cur->elem == NULL) { | ||
| 588 | xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, | ||
| 589 | diff --git a/xmlreader.c b/xmlreader.c | ||
| 590 | index 5fdeb2b..5de168c 100644 | ||
| 591 | --- a/xmlreader.c | ||
| 592 | +++ b/xmlreader.c | ||
| 593 | @@ -572,7 +572,7 @@ xmlTextReaderStartElement(void *ctx, const xmlChar *fullname, | ||
| 594 | if ((ctxt->node != NULL) && (ctxt->input != NULL) && | ||
| 595 | (ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') && | ||
| 596 | (ctxt->input->cur[1] == '>')) | ||
| 597 | - ctxt->node->extra = NODE_IS_EMPTY; | ||
| 598 | + XML_NODE_SET_EXTRA(ctxt->node, NODE_IS_EMPTY); | ||
| 599 | } | ||
| 600 | if (reader != NULL) | ||
| 601 | reader->state = XML_TEXTREADER_ELEMENT; | ||
| 602 | @@ -631,7 +631,7 @@ xmlTextReaderStartElementNs(void *ctx, | ||
| 603 | if ((ctxt->node != NULL) && (ctxt->input != NULL) && | ||
| 604 | (ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') && | ||
| 605 | (ctxt->input->cur[1] == '>')) | ||
| 606 | - ctxt->node->extra = NODE_IS_EMPTY; | ||
| 607 | + XML_NODE_SET_EXTRA(ctxt->node, NODE_IS_EMPTY); | ||
| 608 | } | ||
| 609 | if (reader != NULL) | ||
| 610 | reader->state = XML_TEXTREADER_ELEMENT; | ||
| 611 | @@ -1017,7 +1017,7 @@ skip_children: | ||
| 612 | xmlNodePtr tmp; | ||
| 613 | if (reader->entNr == 0) { | ||
| 614 | while ((tmp = node->last) != NULL) { | ||
| 615 | - if ((tmp->extra & NODE_IS_PRESERVED) == 0) { | ||
| 616 | + if ((XML_NODE_GET_EXTRA(tmp) & NODE_IS_PRESERVED) == 0) { | ||
| 617 | xmlUnlinkNode(tmp); | ||
| 618 | xmlTextReaderFreeNode(reader, tmp); | ||
| 619 | } else | ||
| 620 | @@ -1265,7 +1265,7 @@ get_next_node: | ||
| 621 | if ((oldstate == XML_TEXTREADER_ELEMENT) && | ||
| 622 | (reader->node->type == XML_ELEMENT_NODE) && | ||
| 623 | (reader->node->children == NULL) && | ||
| 624 | - ((reader->node->extra & NODE_IS_EMPTY) == 0) | ||
| 625 | + ((XML_NODE_GET_EXTRA(reader->node) & NODE_IS_EMPTY) == 0) | ||
| 626 | #ifdef LIBXML_XINCLUDE_ENABLED | ||
| 627 | && (reader->in_xinclude <= 0) | ||
| 628 | #endif | ||
| 629 | @@ -1279,7 +1279,7 @@ get_next_node: | ||
| 630 | xmlTextReaderValidatePop(reader); | ||
| 631 | #endif /* LIBXML_REGEXP_ENABLED */ | ||
| 632 | if ((reader->preserves > 0) && | ||
| 633 | - (reader->node->extra & NODE_IS_SPRESERVED)) | ||
| 634 | + (XML_NODE_GET_EXTRA(reader->node) & NODE_IS_SPRESERVED)) | ||
| 635 | reader->preserves--; | ||
| 636 | reader->node = reader->node->next; | ||
| 637 | reader->state = XML_TEXTREADER_ELEMENT; | ||
| 638 | @@ -1295,7 +1295,7 @@ get_next_node: | ||
| 639 | (reader->node->prev != NULL) && | ||
| 640 | (reader->node->prev->type != XML_DTD_NODE)) { | ||
| 641 | xmlNodePtr tmp = reader->node->prev; | ||
| 642 | - if ((tmp->extra & NODE_IS_PRESERVED) == 0) { | ||
| 643 | + if ((XML_NODE_GET_EXTRA(tmp) & NODE_IS_PRESERVED) == 0) { | ||
| 644 | if (oldnode == tmp) | ||
| 645 | oldnode = NULL; | ||
| 646 | xmlUnlinkNode(tmp); | ||
| 647 | @@ -1308,7 +1308,7 @@ get_next_node: | ||
| 648 | if ((oldstate == XML_TEXTREADER_ELEMENT) && | ||
| 649 | (reader->node->type == XML_ELEMENT_NODE) && | ||
| 650 | (reader->node->children == NULL) && | ||
| 651 | - ((reader->node->extra & NODE_IS_EMPTY) == 0)) {; | ||
| 652 | + ((XML_NODE_GET_EXTRA(reader->node) & NODE_IS_EMPTY) == 0)) {; | ||
| 653 | reader->state = XML_TEXTREADER_END; | ||
| 654 | goto node_found; | ||
| 655 | } | ||
| 656 | @@ -1317,7 +1317,7 @@ get_next_node: | ||
| 657 | xmlTextReaderValidatePop(reader); | ||
| 658 | #endif /* LIBXML_REGEXP_ENABLED */ | ||
| 659 | if ((reader->preserves > 0) && | ||
| 660 | - (reader->node->extra & NODE_IS_SPRESERVED)) | ||
| 661 | + (XML_NODE_GET_EXTRA(reader->node) & NODE_IS_SPRESERVED)) | ||
| 662 | reader->preserves--; | ||
| 663 | reader->node = reader->node->parent; | ||
| 664 | if ((reader->node == NULL) || | ||
| 665 | @@ -1341,7 +1341,7 @@ get_next_node: | ||
| 666 | #endif | ||
| 667 | (reader->entNr == 0) && | ||
| 668 | (oldnode->type != XML_DTD_NODE) && | ||
| 669 | - ((oldnode->extra & NODE_IS_PRESERVED) == 0)) { | ||
| 670 | + ((XML_NODE_GET_EXTRA(oldnode) & NODE_IS_PRESERVED) == 0)) { | ||
| 671 | xmlUnlinkNode(oldnode); | ||
| 672 | xmlTextReaderFreeNode(reader, oldnode); | ||
| 673 | } | ||
| 674 | @@ -1354,7 +1354,7 @@ get_next_node: | ||
| 675 | #endif | ||
| 676 | (reader->entNr == 0) && | ||
| 677 | (reader->node->last != NULL) && | ||
| 678 | - ((reader->node->last->extra & NODE_IS_PRESERVED) == 0)) { | ||
| 679 | + ((XML_NODE_GET_EXTRA(reader->node->last) & NODE_IS_PRESERVED) == 0)) { | ||
| 680 | xmlNodePtr tmp = reader->node->last; | ||
| 681 | xmlUnlinkNode(tmp); | ||
| 682 | xmlTextReaderFreeNode(reader, tmp); | ||
| 683 | @@ -1536,7 +1536,7 @@ xmlTextReaderNext(xmlTextReaderPtr reader) { | ||
| 684 | return(xmlTextReaderRead(reader)); | ||
| 685 | if (reader->state == XML_TEXTREADER_END || reader->state == XML_TEXTREADER_BACKTRACK) | ||
| 686 | return(xmlTextReaderRead(reader)); | ||
| 687 | - if (cur->extra & NODE_IS_EMPTY) | ||
| 688 | + if (XML_NODE_GET_EXTRA(cur) & NODE_IS_EMPTY) | ||
| 689 | return(xmlTextReaderRead(reader)); | ||
| 690 | do { | ||
| 691 | ret = xmlTextReaderRead(reader); | ||
| 692 | @@ -2956,7 +2956,7 @@ xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader) { | ||
| 693 | if (reader->in_xinclude > 0) | ||
| 694 | return(1); | ||
| 695 | #endif | ||
| 696 | - return((reader->node->extra & NODE_IS_EMPTY) != 0); | ||
| 697 | + return((XML_NODE_GET_EXTRA(reader->node) & NODE_IS_EMPTY) != 0); | ||
| 698 | } | ||
| 699 | |||
| 700 | /** | ||
| 701 | @@ -3818,15 +3818,15 @@ xmlTextReaderPreserve(xmlTextReaderPtr reader) { | ||
| 702 | return(NULL); | ||
| 703 | |||
| 704 | if ((cur->type != XML_DOCUMENT_NODE) && (cur->type != XML_DTD_NODE)) { | ||
| 705 | - cur->extra |= NODE_IS_PRESERVED; | ||
| 706 | - cur->extra |= NODE_IS_SPRESERVED; | ||
| 707 | + XML_NODE_ADD_EXTRA(cur, NODE_IS_PRESERVED); | ||
| 708 | + XML_NODE_ADD_EXTRA(cur, NODE_IS_SPRESERVED); | ||
| 709 | } | ||
| 710 | reader->preserves++; | ||
| 711 | |||
| 712 | parent = cur->parent;; | ||
| 713 | while (parent != NULL) { | ||
| 714 | if (parent->type == XML_ELEMENT_NODE) | ||
| 715 | - parent->extra |= NODE_IS_PRESERVED; | ||
| 716 | + XML_NODE_ADD_EXTRA(parent, NODE_IS_PRESERVED); | ||
| 717 | parent = parent->parent; | ||
| 718 | } | ||
| 719 | return(cur); | ||
| 720 | diff --git a/xmlschemas.c b/xmlschemas.c | ||
| 721 | index 428e3c8..1f54acc 100644 | ||
| 722 | --- a/xmlschemas.c | ||
| 723 | +++ b/xmlschemas.c | ||
| 724 | @@ -5895,7 +5895,7 @@ xmlSchemaPValAttrNodeID(xmlSchemaParserCtxtPtr ctxt, xmlAttrPtr attr) | ||
| 725 | /* | ||
| 726 | * NOTE: the IDness might have already be declared in the DTD | ||
| 727 | */ | ||
| 728 | - if (attr->atype != XML_ATTRIBUTE_ID) { | ||
| 729 | + if (XML_ATTR_GET_ATYPE(attr) != XML_ATTRIBUTE_ID) { | ||
| 730 | xmlIDPtr res; | ||
| 731 | xmlChar *strip; | ||
| 732 | |||
| 733 | @@ -5918,7 +5918,7 @@ xmlSchemaPValAttrNodeID(xmlSchemaParserCtxtPtr ctxt, xmlAttrPtr attr) | ||
| 734 | NULL, NULL, "Duplicate value '%s' of simple " | ||
| 735 | "type 'xs:ID'", value, NULL); | ||
| 736 | } else | ||
| 737 | - attr->atype = XML_ATTRIBUTE_ID; | ||
| 738 | + XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_ID); | ||
| 739 | } | ||
| 740 | } else if (ret > 0) { | ||
| 741 | ret = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE; | ||
| 742 | diff --git a/xmlschemastypes.c b/xmlschemastypes.c | ||
| 743 | index de95d94..76a7c87 100644 | ||
| 744 | --- a/xmlschemastypes.c | ||
| 745 | +++ b/xmlschemastypes.c | ||
| 746 | @@ -2969,7 +2969,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, | ||
| 747 | /* | ||
| 748 | * NOTE: the IDness might have already be declared in the DTD | ||
| 749 | */ | ||
| 750 | - if (attr->atype != XML_ATTRIBUTE_ID) { | ||
| 751 | + if (XML_ATTR_GET_ATYPE(attr) != XML_ATTRIBUTE_ID) { | ||
| 752 | xmlIDPtr res; | ||
| 753 | xmlChar *strip; | ||
| 754 | |||
| 755 | @@ -2982,7 +2982,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, | ||
| 756 | if (res == NULL) { | ||
| 757 | ret = 2; | ||
| 758 | } else { | ||
| 759 | - attr->atype = XML_ATTRIBUTE_ID; | ||
| 760 | + XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_ID); | ||
| 761 | } | ||
| 762 | } | ||
| 763 | } | ||
| 764 | @@ -3007,7 +3007,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, | ||
| 765 | xmlFree(strip); | ||
| 766 | } else | ||
| 767 | xmlAddRef(NULL, node->doc, value, attr); | ||
| 768 | - attr->atype = XML_ATTRIBUTE_IDREF; | ||
| 769 | + XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_IDREF); | ||
| 770 | } | ||
| 771 | goto done; | ||
| 772 | case XML_SCHEMAS_IDREFS: | ||
| 773 | @@ -3021,7 +3021,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, | ||
| 774 | (node->type == XML_ATTRIBUTE_NODE)) { | ||
| 775 | xmlAttrPtr attr = (xmlAttrPtr) node; | ||
| 776 | |||
| 777 | - attr->atype = XML_ATTRIBUTE_IDREFS; | ||
| 778 | + XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_IDREFS); | ||
| 779 | } | ||
| 780 | goto done; | ||
| 781 | case XML_SCHEMAS_ENTITY:{ | ||
| 782 | @@ -3052,7 +3052,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, | ||
| 783 | (node->type == XML_ATTRIBUTE_NODE)) { | ||
| 784 | xmlAttrPtr attr = (xmlAttrPtr) node; | ||
| 785 | |||
| 786 | - attr->atype = XML_ATTRIBUTE_ENTITY; | ||
| 787 | + XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_ENTITY); | ||
| 788 | } | ||
| 789 | goto done; | ||
| 790 | } | ||
| 791 | @@ -3069,7 +3069,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, | ||
| 792 | (node->type == XML_ATTRIBUTE_NODE)) { | ||
| 793 | xmlAttrPtr attr = (xmlAttrPtr) node; | ||
| 794 | |||
| 795 | - attr->atype = XML_ATTRIBUTE_ENTITIES; | ||
| 796 | + XML_ATTR_SET_ATYPE(attr, XML_ATTRIBUTE_ENTITIES); | ||
| 797 | } | ||
| 798 | goto done; | ||
| 799 | case XML_SCHEMAS_NOTATION:{ | ||
| 800 | -- | ||
| 801 | 2.50.1 | ||
| 802 | |||
diff --git a/meta/recipes-core/libxml/libxml2_2.12.10.bb b/meta/recipes-core/libxml/libxml2_2.12.10.bb index a155c3708e..101be545c0 100644 --- a/meta/recipes-core/libxml/libxml2_2.12.10.bb +++ b/meta/recipes-core/libxml/libxml2_2.12.10.bb | |||
| @@ -24,6 +24,7 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20130923.tar;subdir=${BP};name=testt | |||
| 24 | file://CVE-2025-49794-CVE-2025-49796.patch \ | 24 | file://CVE-2025-49794-CVE-2025-49796.patch \ |
| 25 | file://CVE-2025-49795.patch \ | 25 | file://CVE-2025-49795.patch \ |
| 26 | file://CVE-2025-6170.patch \ | 26 | file://CVE-2025-6170.patch \ |
| 27 | file://CVE-2025-7425.patch \ | ||
| 27 | " | 28 | " |
| 28 | 29 | ||
| 29 | SRC_URI[archive.sha256sum] = "c3d8c0c34aa39098f66576fe51969db12a5100b956233dc56506f7a8679be995" | 30 | SRC_URI[archive.sha256sum] = "c3d8c0c34aa39098f66576fe51969db12a5100b956233dc56506f7a8679be995" |
