libxml2: Update to 2.9.13
This commit is contained in:
parent
1f23512d3f
commit
d9e76db9ea
@ -2,10 +2,10 @@ TERMUX_PKG_HOMEPAGE=http://www.xmlsoft.org
|
||||
TERMUX_PKG_DESCRIPTION="Library for parsing XML documents"
|
||||
TERMUX_PKG_LICENSE="MIT"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=2.9.12
|
||||
TERMUX_PKG_REVISION=1
|
||||
TERMUX_PKG_SRCURL=ftp://xmlsoft.org/libxml2/libxml2-${TERMUX_PKG_VERSION}.tar.gz
|
||||
TERMUX_PKG_SHA256=c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92
|
||||
_MAJOR_VERSION=2.9
|
||||
TERMUX_PKG_VERSION=${_MAJOR_VERSION}.13
|
||||
TERMUX_PKG_SRCURL=https://download.gnome.org/sources/libxml2/${_MAJOR_VERSION}/libxml2-${TERMUX_PKG_VERSION}.tar.xz
|
||||
TERMUX_PKG_SHA256=276130602d12fe484ecc03447ee5e759d0465558fbc9d6bd144e3745306ebf0e
|
||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--without-python"
|
||||
TERMUX_PKG_RM_AFTER_INSTALL="share/gtk-doc"
|
||||
TERMUX_PKG_DEPENDS="libiconv, liblzma, zlib"
|
||||
|
@ -1,224 +0,0 @@
|
||||
https://github.com/GNOME/libxml2/commit/85b1792e37b131e7a51af98a37f92472e8de5f3f
|
||||
diff --git a/HTMLtree.c b/HTMLtree.c
|
||||
index 24434d453..bdd639c7f 100644
|
||||
--- a/HTMLtree.c
|
||||
+++ b/HTMLtree.c
|
||||
@@ -744,7 +744,7 @@ void
|
||||
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
xmlNodePtr cur, const char *encoding ATTRIBUTE_UNUSED,
|
||||
int format) {
|
||||
- xmlNodePtr root;
|
||||
+ xmlNodePtr root, parent;
|
||||
xmlAttrPtr attr;
|
||||
const htmlElemDesc * info;
|
||||
|
||||
@@ -755,6 +755,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
}
|
||||
|
||||
root = cur;
|
||||
+ parent = cur->parent;
|
||||
while (1) {
|
||||
switch (cur->type) {
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
@@ -762,13 +763,25 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
if (((xmlDocPtr) cur)->intSubset != NULL) {
|
||||
htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
|
||||
}
|
||||
- if (cur->children != NULL) {
|
||||
+ /* Always validate cur->parent when descending. */
|
||||
+ if ((cur->parent == parent) && (cur->children != NULL)) {
|
||||
+ parent = cur;
|
||||
cur = cur->children;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_ELEMENT_NODE:
|
||||
+ /*
|
||||
+ * Some users like lxml are known to pass nodes with a corrupted
|
||||
+ * tree structure. Fall back to a recursive call to handle this
|
||||
+ * case.
|
||||
+ */
|
||||
+ if ((cur->parent != parent) && (cur->children != NULL)) {
|
||||
+ htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Get specific HTML info for that node.
|
||||
*/
|
||||
@@ -817,6 +830,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
(cur->name != NULL) &&
|
||||
(cur->name[0] != 'p')) /* p, pre, param */
|
||||
xmlOutputBufferWriteString(buf, "\n");
|
||||
+ parent = cur;
|
||||
cur = cur->children;
|
||||
continue;
|
||||
}
|
||||
@@ -825,9 +839,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
(info != NULL) && (!info->isinline)) {
|
||||
if ((cur->next->type != HTML_TEXT_NODE) &&
|
||||
(cur->next->type != HTML_ENTITY_REF_NODE) &&
|
||||
- (cur->parent != NULL) &&
|
||||
- (cur->parent->name != NULL) &&
|
||||
- (cur->parent->name[0] != 'p')) /* p, pre, param */
|
||||
+ (parent != NULL) &&
|
||||
+ (parent->name != NULL) &&
|
||||
+ (parent->name[0] != 'p')) /* p, pre, param */
|
||||
xmlOutputBufferWriteString(buf, "\n");
|
||||
}
|
||||
|
||||
@@ -842,9 +856,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
break;
|
||||
if (((cur->name == (const xmlChar *)xmlStringText) ||
|
||||
(cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
|
||||
- ((cur->parent == NULL) ||
|
||||
- ((xmlStrcasecmp(cur->parent->name, BAD_CAST "script")) &&
|
||||
- (xmlStrcasecmp(cur->parent->name, BAD_CAST "style"))))) {
|
||||
+ ((parent == NULL) ||
|
||||
+ ((xmlStrcasecmp(parent->name, BAD_CAST "script")) &&
|
||||
+ (xmlStrcasecmp(parent->name, BAD_CAST "style"))))) {
|
||||
xmlChar *buffer;
|
||||
|
||||
buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
|
||||
@@ -902,13 +916,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
break;
|
||||
}
|
||||
|
||||
- /*
|
||||
- * The parent should never be NULL here but we want to handle
|
||||
- * corrupted documents gracefully.
|
||||
- */
|
||||
- if (cur->parent == NULL)
|
||||
- return;
|
||||
- cur = cur->parent;
|
||||
+ cur = parent;
|
||||
+ /* cur->parent was validated when descending. */
|
||||
+ parent = cur->parent;
|
||||
|
||||
if ((cur->type == XML_HTML_DOCUMENT_NODE) ||
|
||||
(cur->type == XML_DOCUMENT_NODE)) {
|
||||
@@ -939,9 +949,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
(cur->next != NULL)) {
|
||||
if ((cur->next->type != HTML_TEXT_NODE) &&
|
||||
(cur->next->type != HTML_ENTITY_REF_NODE) &&
|
||||
- (cur->parent != NULL) &&
|
||||
- (cur->parent->name != NULL) &&
|
||||
- (cur->parent->name[0] != 'p')) /* p, pre, param */
|
||||
+ (parent != NULL) &&
|
||||
+ (parent->name != NULL) &&
|
||||
+ (parent->name[0] != 'p')) /* p, pre, param */
|
||||
xmlOutputBufferWriteString(buf, "\n");
|
||||
}
|
||||
}
|
||||
diff --git a/xmlsave.c b/xmlsave.c
|
||||
index 61a40459b..aedbd5e70 100644
|
||||
--- a/xmlsave.c
|
||||
+++ b/xmlsave.c
|
||||
@@ -847,7 +847,7 @@ htmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
|
||||
static void
|
||||
xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
|
||||
int format = ctxt->format;
|
||||
- xmlNodePtr tmp, root, unformattedNode = NULL;
|
||||
+ xmlNodePtr tmp, root, unformattedNode = NULL, parent;
|
||||
xmlAttrPtr attr;
|
||||
xmlChar *start, *end;
|
||||
xmlOutputBufferPtr buf;
|
||||
@@ -856,6 +856,7 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
|
||||
buf = ctxt->buf;
|
||||
|
||||
root = cur;
|
||||
+ parent = cur->parent;
|
||||
while (1) {
|
||||
switch (cur->type) {
|
||||
case XML_DOCUMENT_NODE:
|
||||
@@ -868,7 +869,9 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
|
||||
break;
|
||||
|
||||
case XML_DOCUMENT_FRAG_NODE:
|
||||
- if (cur->children != NULL) {
|
||||
+ /* Always validate cur->parent when descending. */
|
||||
+ if ((cur->parent == parent) && (cur->children != NULL)) {
|
||||
+ parent = cur;
|
||||
cur = cur->children;
|
||||
continue;
|
||||
}
|
||||
@@ -887,7 +890,18 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
|
||||
break;
|
||||
|
||||
case XML_ELEMENT_NODE:
|
||||
- if ((cur != root) && (ctxt->format == 1) && (xmlIndentTreeOutput))
|
||||
+ /*
|
||||
+ * Some users like lxml are known to pass nodes with a corrupted
|
||||
+ * tree structure. Fall back to a recursive call to handle this
|
||||
+ * case.
|
||||
+ */
|
||||
+ if ((cur->parent != parent) && (cur->children != NULL)) {
|
||||
+ xmlNodeDumpOutputInternal(ctxt, cur);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if ((ctxt->level > 0) && (ctxt->format == 1) &&
|
||||
+ (xmlIndentTreeOutput))
|
||||
xmlOutputBufferWrite(buf, ctxt->indent_size *
|
||||
(ctxt->level > ctxt->indent_nr ?
|
||||
ctxt->indent_nr : ctxt->level),
|
||||
@@ -942,6 +956,7 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
|
||||
xmlOutputBufferWrite(buf, 1, ">");
|
||||
if (ctxt->format == 1) xmlOutputBufferWrite(buf, 1, "\n");
|
||||
if (ctxt->level >= 0) ctxt->level++;
|
||||
+ parent = cur;
|
||||
cur = cur->children;
|
||||
continue;
|
||||
}
|
||||
@@ -1058,13 +1073,9 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
|
||||
break;
|
||||
}
|
||||
|
||||
- /*
|
||||
- * The parent should never be NULL here but we want to handle
|
||||
- * corrupted documents gracefully.
|
||||
- */
|
||||
- if (cur->parent == NULL)
|
||||
- return;
|
||||
- cur = cur->parent;
|
||||
+ cur = parent;
|
||||
+ /* cur->parent was validated when descending. */
|
||||
+ parent = cur->parent;
|
||||
|
||||
if (cur->type == XML_ELEMENT_NODE) {
|
||||
if (ctxt->level > 0) ctxt->level--;
|
||||
|
||||
https://github.com/GNOME/libxml2/commit/13ad8736d294536da4cbcd70a96b0a2fbf47070c
|
||||
diff --git a/xmlsave.c b/xmlsave.c
|
||||
index aedbd5e70..489505f48 100644
|
||||
--- a/xmlsave.c
|
||||
+++ b/xmlsave.c
|
||||
@@ -890,6 +890,13 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
|
||||
break;
|
||||
|
||||
case XML_ELEMENT_NODE:
|
||||
+ if ((cur != root) && (ctxt->format == 1) &&
|
||||
+ (xmlIndentTreeOutput))
|
||||
+ xmlOutputBufferWrite(buf, ctxt->indent_size *
|
||||
+ (ctxt->level > ctxt->indent_nr ?
|
||||
+ ctxt->indent_nr : ctxt->level),
|
||||
+ ctxt->indent);
|
||||
+
|
||||
/*
|
||||
* Some users like lxml are known to pass nodes with a corrupted
|
||||
* tree structure. Fall back to a recursive call to handle this
|
||||
@@ -900,13 +907,6 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
|
||||
break;
|
||||
}
|
||||
|
||||
- if ((ctxt->level > 0) && (ctxt->format == 1) &&
|
||||
- (xmlIndentTreeOutput))
|
||||
- xmlOutputBufferWrite(buf, ctxt->indent_size *
|
||||
- (ctxt->level > ctxt->indent_nr ?
|
||||
- ctxt->indent_nr : ctxt->level),
|
||||
- ctxt->indent);
|
||||
-
|
||||
xmlOutputBufferWrite(buf, 1, "<");
|
||||
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
|
||||
xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
|
@ -8,22 +8,27 @@ diff --git a/tree.c b/tree.c
|
||||
index 08b1a50..f2b1457 100644
|
||||
--- a/tree.c
|
||||
+++ b/tree.c
|
||||
@@ -3664,9 +3664,7 @@ xmlNextElementSibling(xmlNodePtr node) {
|
||||
@@ -3693,9 +3693,7 @@ xmlNextElementSibling(xmlNodePtr node) {
|
||||
void
|
||||
xmlFreeNodeList(xmlNodePtr cur) {
|
||||
xmlNodePtr next;
|
||||
- xmlNodePtr parent;
|
||||
xmlDictPtr dict = NULL;
|
||||
- size_t depth = 0;
|
||||
|
||||
|
||||
if (cur == NULL) return;
|
||||
if (cur->type == XML_NAMESPACE_DECL) {
|
||||
@@ -3682,21 +3680,16 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
||||
@@ -3703,21 +3701,8 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
||||
return;
|
||||
}
|
||||
if (cur->doc != NULL) dict = cur->doc->dict;
|
||||
- while (1) {
|
||||
- while ((cur->children != NULL) &&
|
||||
- (cur->type != XML_DOCUMENT_NODE) &&
|
||||
-#ifdef LIBXML_DOCB_ENABLED
|
||||
- (cur->type != XML_DOCB_DOCUMENT_NODE) &&
|
||||
-#endif
|
||||
- (cur->type != XML_HTML_DOCUMENT_NODE) &&
|
||||
- (cur->type != XML_DTD_NODE) &&
|
||||
- (cur->type != XML_ENTITY_REF_NODE)) {
|
||||
- cur = cur->children;
|
||||
@ -33,18 +38,20 @@ index 08b1a50..f2b1457 100644
|
||||
+ while (cur != NULL) {
|
||||
next = cur->next;
|
||||
- parent = cur->parent;
|
||||
if (cur->type != XML_DTD_NODE) {
|
||||
|
||||
if ((cur->type == XML_DOCUMENT_NODE) ||
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
(cur->type == XML_DOCB_DOCUMENT_NODE) ||
|
||||
@@ -3729,6 +3714,9 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
||||
if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
|
||||
xmlDeregisterNodeDefaultValue(cur);
|
||||
|
||||
|
||||
+ if ((cur->children != NULL) &&
|
||||
+ (cur->type != XML_ENTITY_REF_NODE))
|
||||
+ xmlFreeNodeList(cur->children);
|
||||
if (((cur->type == XML_ELEMENT_NODE) ||
|
||||
(cur->type == XML_XINCLUDE_START) ||
|
||||
(cur->type == XML_XINCLUDE_END)) &&
|
||||
@@ -3727,15 +3720,6 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
||||
@@ -3759,16 +3747,7 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
||||
DICT_FREE(cur->name)
|
||||
xmlFree(cur);
|
||||
}
|
||||
@ -61,3 +68,4 @@ index 08b1a50..f2b1457 100644
|
||||
+ cur = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user