Initialize for libxml2
This commit is contained in:
commit
93225a0624
12 changed files with 2494 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
libxml2-2.10.3.tar.xz
|
||||||
|
xmlts20080827.tar.gz
|
2
.libxml2.metadata
Normal file
2
.libxml2.metadata
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
d671b6e1c32277d2aec7395777706c9955f718cf74f29001c6cdea0d9d98d148 libxml2-2.10.3.tar.xz
|
||||||
|
c107ee20aff1a4dbb06656a124c617ebc876e2863ef6f07b82eb99eebc329d67 xmlts20080827.tar.gz
|
6
baselibs.conf
Normal file
6
baselibs.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
libxml2-2
|
||||||
|
obsoletes "libxml2-<targettype> < <version>"
|
||||||
|
provides "libxml2-<targettype> = <version>"
|
||||||
|
libxml2-devel
|
||||||
|
requires -libxml2-<targettype>
|
||||||
|
requires "libxml2-2-<targettype> = <version>"
|
74
libxml2-CVE-2023-28484-1.patch
Normal file
74
libxml2-CVE-2023-28484-1.patch
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
From 647e072ea0a2f12687fa05c172f4c4713fdb0c4f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||||
|
Date: Fri, 7 Apr 2023 11:46:35 +0200
|
||||||
|
Subject: [PATCH] [CVE-2023-28484] Fix null deref in xmlSchemaFixupComplexType
|
||||||
|
|
||||||
|
Fix a null pointer dereference when parsing (invalid) XML schemas.
|
||||||
|
|
||||||
|
Thanks to Robby Simpson for the report!
|
||||||
|
|
||||||
|
Fixes #491.
|
||||||
|
---
|
||||||
|
result/schemas/issue491_0_0.err | 1 +
|
||||||
|
test/schemas/issue491_0.xml | 1 +
|
||||||
|
test/schemas/issue491_0.xsd | 18 ++++++++++++++++++
|
||||||
|
xmlschemas.c | 2 +-
|
||||||
|
4 files changed, 21 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 result/schemas/issue491_0_0.err
|
||||||
|
create mode 100644 test/schemas/issue491_0.xml
|
||||||
|
create mode 100644 test/schemas/issue491_0.xsd
|
||||||
|
|
||||||
|
diff --git a/result/schemas/issue491_0_0.err b/result/schemas/issue491_0_0.err
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..9b2bb969
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/result/schemas/issue491_0_0.err
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+./test/schemas/issue491_0.xsd:8: element complexType: Schemas parser error : complex type 'ChildType': The content type of both, the type and its base type, must either 'mixed' or 'element-only'.
|
||||||
|
diff --git a/test/schemas/issue491_0.xml b/test/schemas/issue491_0.xml
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..e2b2fc2e
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/schemas/issue491_0.xml
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+<Child xmlns="http://www.test.com">5</Child>
|
||||||
|
diff --git a/test/schemas/issue491_0.xsd b/test/schemas/issue491_0.xsd
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..81702649
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/schemas/issue491_0.xsd
|
||||||
|
@@ -0,0 +1,18 @@
|
||||||
|
+<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.test.com" targetNamespace="http://www.test.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||||
|
+ <xs:complexType name="BaseType">
|
||||||
|
+ <xs:simpleContent>
|
||||||
|
+ <xs:extension base="xs:int" />
|
||||||
|
+ </xs:simpleContent>
|
||||||
|
+ </xs:complexType>
|
||||||
|
+ <xs:complexType name="ChildType">
|
||||||
|
+ <xs:complexContent>
|
||||||
|
+ <xs:extension base="BaseType">
|
||||||
|
+ <xs:sequence>
|
||||||
|
+ <xs:element name="bad" type="xs:int" minOccurs="0" maxOccurs="1"/>
|
||||||
|
+ </xs:sequence>
|
||||||
|
+ </xs:extension>
|
||||||
|
+ </xs:complexContent>
|
||||||
|
+ </xs:complexType>
|
||||||
|
+ <xs:element name="Child" type="ChildType" />
|
||||||
|
+</xs:schema>
|
||||||
|
diff --git a/xmlschemas.c b/xmlschemas.c
|
||||||
|
index 152b7c3f..eec24a95 100644
|
||||||
|
--- a/xmlschemas.c
|
||||||
|
+++ b/xmlschemas.c
|
||||||
|
@@ -18619,7 +18619,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt,
|
||||||
|
"allowed to appear inside other model groups",
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
|
- } else if (! dummySequence) {
|
||||||
|
+ } else if ((!dummySequence) && (baseType->subtypes != NULL)) {
|
||||||
|
xmlSchemaTreeItemPtr effectiveContent =
|
||||||
|
(xmlSchemaTreeItemPtr) type->subtypes;
|
||||||
|
/*
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
71
libxml2-CVE-2023-28484-2.patch
Normal file
71
libxml2-CVE-2023-28484-2.patch
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
From 4c6922f763ad958c48ff66f82823ae21f2e92ee6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||||
|
Date: Tue, 13 Sep 2022 16:40:31 +0200
|
||||||
|
Subject: [PATCH] schemas: Fix null-pointer-deref in
|
||||||
|
xmlSchemaCheckCOSSTDerivedOK
|
||||||
|
|
||||||
|
Found by OSS-Fuzz.
|
||||||
|
---
|
||||||
|
result/schemas/oss-fuzz-51295_0_0.err | 2 ++
|
||||||
|
test/schemas/oss-fuzz-51295_0.xml | 1 +
|
||||||
|
test/schemas/oss-fuzz-51295_0.xsd | 4 ++++
|
||||||
|
xmlschemas.c | 15 +++++++++++++--
|
||||||
|
4 files changed, 20 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 result/schemas/oss-fuzz-51295_0_0.err
|
||||||
|
create mode 100644 test/schemas/oss-fuzz-51295_0.xml
|
||||||
|
create mode 100644 test/schemas/oss-fuzz-51295_0.xsd
|
||||||
|
|
||||||
|
diff --git a/result/schemas/oss-fuzz-51295_0_0.err b/result/schemas/oss-fuzz-51295_0_0.err
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..1e89524f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/result/schemas/oss-fuzz-51295_0_0.err
|
||||||
|
@@ -0,0 +1,2 @@
|
||||||
|
+./test/schemas/oss-fuzz-51295_0.xsd:2: element element: Schemas parser error : element decl. 'e': The element declaration 'e' defines a circular substitution group to element declaration 'e'.
|
||||||
|
+./test/schemas/oss-fuzz-51295_0.xsd:2: element element: Schemas parser error : element decl. 'e': The element declaration 'e' defines a circular substitution group to element declaration 'e'.
|
||||||
|
diff --git a/test/schemas/oss-fuzz-51295_0.xml b/test/schemas/oss-fuzz-51295_0.xml
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..10a7e703
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/schemas/oss-fuzz-51295_0.xml
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+<e/>
|
||||||
|
diff --git a/test/schemas/oss-fuzz-51295_0.xsd b/test/schemas/oss-fuzz-51295_0.xsd
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..fde96af5
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/schemas/oss-fuzz-51295_0.xsd
|
||||||
|
@@ -0,0 +1,4 @@
|
||||||
|
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
+ <xs:element name="e" substitutionGroup="e"/>
|
||||||
|
+ <xs:element name="t" substitutionGroup="e" type='xs:decimal'/>
|
||||||
|
+</xs:schema>
|
||||||
|
diff --git a/xmlschemas.c b/xmlschemas.c
|
||||||
|
index f31d3d1f..152b7c3f 100644
|
||||||
|
--- a/xmlschemas.c
|
||||||
|
+++ b/xmlschemas.c
|
||||||
|
@@ -13345,8 +13345,19 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl,
|
||||||
|
* declaration `resolved` to by the `actual value`
|
||||||
|
* of the substitutionGroup [attribute], if present"
|
||||||
|
*/
|
||||||
|
- if (elemDecl->subtypes == NULL)
|
||||||
|
- elemDecl->subtypes = substHead->subtypes;
|
||||||
|
+ if (elemDecl->subtypes == NULL) {
|
||||||
|
+ if (substHead->subtypes == NULL) {
|
||||||
|
+ /*
|
||||||
|
+ * This can happen with self-referencing substitution
|
||||||
|
+ * groups. The cycle will be detected later, but we have
|
||||||
|
+ * to set subtypes to avoid null-pointer dereferences.
|
||||||
|
+ */
|
||||||
|
+ elemDecl->subtypes = xmlSchemaGetBuiltInType(
|
||||||
|
+ XML_SCHEMAS_ANYTYPE);
|
||||||
|
+ } else {
|
||||||
|
+ elemDecl->subtypes = substHead->subtypes;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
37
libxml2-CVE-2023-29469.patch
Normal file
37
libxml2-CVE-2023-29469.patch
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
From 09a2dd453007f9c7205274623acdd73747c22d64 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||||
|
Date: Fri, 7 Apr 2023 11:49:27 +0200
|
||||||
|
Subject: [PATCH] [CVE-2023-29469] Hashing of empty dict strings isn't
|
||||||
|
deterministic
|
||||||
|
|
||||||
|
When hashing empty strings which aren't null-terminated,
|
||||||
|
xmlDictComputeFastKey could produce inconsistent results. This could
|
||||||
|
lead to various logic or memory errors, including double frees.
|
||||||
|
|
||||||
|
For consistency the seed is also taken into account, but this shouldn't
|
||||||
|
have an impact on security.
|
||||||
|
|
||||||
|
Found by OSS-Fuzz.
|
||||||
|
|
||||||
|
Fixes #510.
|
||||||
|
---
|
||||||
|
dict.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/dict.c b/dict.c
|
||||||
|
index c29d2af7..12ba94fd 100644
|
||||||
|
--- a/dict.c
|
||||||
|
+++ b/dict.c
|
||||||
|
@@ -453,7 +453,8 @@ static unsigned long
|
||||||
|
xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
|
||||||
|
unsigned long value = seed;
|
||||||
|
|
||||||
|
- if (name == NULL) return(0);
|
||||||
|
+ if ((name == NULL) || (namelen <= 0))
|
||||||
|
+ return(value);
|
||||||
|
value += *name;
|
||||||
|
value <<= 5;
|
||||||
|
if (namelen > 10) {
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
29
libxml2-CVE-2023-39615.patch
Normal file
29
libxml2-CVE-2023-39615.patch
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
From d0c3f01e110d54415611c5fa0040cdf4a56053f9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||||
|
Date: Sat, 6 May 2023 17:47:37 +0200
|
||||||
|
Subject: [PATCH] parser: Fix old SAX1 parser with custom callbacks
|
||||||
|
|
||||||
|
For some reason, xmlCtxtUseOptionsInternal set the start and end element
|
||||||
|
SAX handlers to the internal DOM builder functions when XML_PARSE_SAX1
|
||||||
|
was specified. This means that custom SAX handlers could never work with
|
||||||
|
that flag because these functions would receive the wrong user data
|
||||||
|
argument and crash immediately.
|
||||||
|
|
||||||
|
Fixes #535.
|
||||||
|
---
|
||||||
|
parser.c | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
|
||||||
|
Index: libxml2-2.10.4/parser.c
|
||||||
|
===================================================================
|
||||||
|
--- libxml2-2.10.4.orig/parser.c
|
||||||
|
+++ libxml2-2.10.4/parser.c
|
||||||
|
@@ -15064,8 +15064,6 @@ xmlCtxtUseOptionsInternal(xmlParserCtxtP
|
||||||
|
}
|
||||||
|
#ifdef LIBXML_SAX1_ENABLED
|
||||||
|
if (options & XML_PARSE_SAX1) {
|
||||||
|
- ctxt->sax->startElement = xmlSAX2StartElement;
|
||||||
|
- ctxt->sax->endElement = xmlSAX2EndElement;
|
||||||
|
ctxt->sax->startElementNs = NULL;
|
||||||
|
ctxt->sax->endElementNs = NULL;
|
||||||
|
ctxt->sax->initialized = 1;
|
100
libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch
Normal file
100
libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
---
|
||||||
|
xpath.c | 40 +++++++++++++++++++++++++++++-----------
|
||||||
|
1 file changed, 29 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
Index: libxml2-2.10.3/xpath.c
|
||||||
|
===================================================================
|
||||||
|
--- libxml2-2.10.3.orig/xpath.c
|
||||||
|
+++ libxml2-2.10.3/xpath.c
|
||||||
|
@@ -113,14 +113,32 @@
|
||||||
|
#define XPATH_MAX_STACK_DEPTH 1000000
|
||||||
|
|
||||||
|
/*
|
||||||
|
- * XPATH_MAX_NODESET_LENGTH:
|
||||||
|
+ * XPATH_DEFAULT_MAX_NODESET_LENGTH:
|
||||||
|
* when evaluating an XPath expression nodesets are created and we
|
||||||
|
- * arbitrary limit the maximum length of those node set. 10000000 is
|
||||||
|
- * an insanely large value which should never be reached under normal
|
||||||
|
- * circumstances, one would first need to construct an in memory tree
|
||||||
|
+ * arbitrary limit the maximum length of those node set. Default value is
|
||||||
|
+ * 10000000, an insanely large value which should never be reached under
|
||||||
|
+ * normal circumstances, one would first need to construct an in memory tree
|
||||||
|
* with more than 10 millions nodes.
|
||||||
|
+ *
|
||||||
|
+ * Adjustable via LIBXML_MAX_NODESET_LENGTH env variable.
|
||||||
|
+ * Absolute maximum is INT_MAX.
|
||||||
|
*/
|
||||||
|
-#define XPATH_MAX_NODESET_LENGTH 10000000
|
||||||
|
+#define XPATH_DEFAULT_MAX_NODESET_LENGTH 10000000
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+get_max_nodeset_len() {
|
||||||
|
+ const char *max_nodeset_len_str = getenv("LIBXML_MAX_NODESET_LENGTH");
|
||||||
|
+ int max_nodeset_len = XPATH_DEFAULT_MAX_NODESET_LENGTH;
|
||||||
|
+
|
||||||
|
+ if (max_nodeset_len_str != NULL) {
|
||||||
|
+ max_nodeset_len = strtol(max_nodeset_len_str, NULL, 10);
|
||||||
|
+
|
||||||
|
+ if (max_nodeset_len <= 0 || max_nodeset_len > INT_MAX)
|
||||||
|
+ max_nodeset_len = XPATH_DEFAULT_MAX_NODESET_LENGTH;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return max_nodeset_len;
|
||||||
|
+}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPATH_MAX_RECRUSION_DEPTH:
|
||||||
|
@@ -3689,7 +3707,7 @@ xmlXPathNodeSetAddNs(xmlNodeSetPtr cur,
|
||||||
|
} else if (cur->nodeNr == cur->nodeMax) {
|
||||||
|
xmlNodePtr *temp;
|
||||||
|
|
||||||
|
- if (cur->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
|
||||||
|
+ if (cur->nodeMax >= get_max_nodeset_len()) {
|
||||||
|
xmlXPathErrMemory(NULL, "growing nodeset hit limit\n");
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
@@ -3745,7 +3763,7 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xm
|
||||||
|
} else if (cur->nodeNr == cur->nodeMax) {
|
||||||
|
xmlNodePtr *temp;
|
||||||
|
|
||||||
|
- if (cur->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
|
||||||
|
+ if (cur->nodeMax >= get_max_nodeset_len()) {
|
||||||
|
xmlXPathErrMemory(NULL, "growing nodeset hit limit\n");
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
@@ -3800,7 +3818,7 @@ xmlXPathNodeSetAddUnique(xmlNodeSetPtr c
|
||||||
|
} else if (cur->nodeNr == cur->nodeMax) {
|
||||||
|
xmlNodePtr *temp;
|
||||||
|
|
||||||
|
- if (cur->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
|
||||||
|
+ if (cur->nodeMax >= get_max_nodeset_len()) {
|
||||||
|
xmlXPathErrMemory(NULL, "growing nodeset hit limit\n");
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
@@ -3917,7 +3935,7 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1,
|
||||||
|
} else if (val1->nodeNr == val1->nodeMax) {
|
||||||
|
xmlNodePtr *temp;
|
||||||
|
|
||||||
|
- if (val1->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
|
||||||
|
+ if (val1->nodeMax >= get_max_nodeset_len()) {
|
||||||
|
xmlXPathErrMemory(NULL, "merging nodeset hit limit\n");
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
@@ -4003,7 +4021,7 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetP
|
||||||
|
} else if (set1->nodeNr >= set1->nodeMax) {
|
||||||
|
xmlNodePtr *temp;
|
||||||
|
|
||||||
|
- if (set1->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
|
||||||
|
+ if (set1->nodeMax >= get_max_nodeset_len()) {
|
||||||
|
xmlXPathErrMemory(NULL, "merging nodeset hit limit\n");
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
@@ -4057,7 +4075,7 @@ xmlXPathNodeSetMergeAndClearNoDupls(xmlN
|
||||||
|
} else if (set1->nodeNr >= set1->nodeMax) {
|
||||||
|
xmlNodePtr *temp;
|
||||||
|
|
||||||
|
- if (set1->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
|
||||||
|
+ if (set1->nodeMax >= get_max_nodeset_len()) {
|
||||||
|
xmlXPathErrMemory(NULL, "merging nodeset hit limit\n");
|
||||||
|
return(NULL);
|
||||||
|
}
|
28
libxml2-python3-string-null-check.patch
Normal file
28
libxml2-python3-string-null-check.patch
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
From 07b1c4c8a736a31ac4b8ae13ea25d50793dfea83 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Gorse <mgorse@alum.wpi.edu>
|
||||||
|
Date: Fri, 25 Jan 2019 12:55:52 -0600
|
||||||
|
Subject: [PATCH] python: return None if PY_IMPORT_STRING returns NULL
|
||||||
|
|
||||||
|
PY_IMPORT_STRING might return NULL on python 3 if, ie, a string can't be
|
||||||
|
encoded. We should check for this and return None, rather than returning
|
||||||
|
NULL. Fixes a NULL pointer dereference when reporting an error with an
|
||||||
|
invalid string.
|
||||||
|
---
|
||||||
|
python/types.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
Index: libxml2-2.10.3/python/types.c
|
||||||
|
===================================================================
|
||||||
|
--- libxml2-2.10.3.orig/python/types.c
|
||||||
|
+++ libxml2-2.10.3/python/types.c
|
||||||
|
@@ -274,6 +274,10 @@ libxml_charPtrConstWrap(const char *str)
|
||||||
|
return (Py_None);
|
||||||
|
}
|
||||||
|
ret = PY_IMPORT_STRING(str);
|
||||||
|
+ if (ret == NULL) {
|
||||||
|
+ Py_INCREF(Py_None);
|
||||||
|
+ return (Py_None);
|
||||||
|
+ }
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
36
libxml2-python3-unicode-errors.patch
Normal file
36
libxml2-python3-unicode-errors.patch
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
---
|
||||||
|
python/libxml.c | 11 ++++++++++-
|
||||||
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/python/libxml.c
|
||||||
|
+++ b/python/libxml.c
|
||||||
|
@@ -1621,6 +1621,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
|
||||||
|
PyObject *message;
|
||||||
|
PyObject *result;
|
||||||
|
char str[1000];
|
||||||
|
+ unsigned char *ptr = (unsigned char *)str;
|
||||||
|
|
||||||
|
#ifdef DEBUG_ERROR
|
||||||
|
printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
|
||||||
|
@@ -1637,12 +1638,20 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
|
||||||
|
str[999] = 0;
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
+#if PY_MAJOR_VERSION >= 3
|
||||||
|
+ /* Ensure the error string doesn't start at UTF8 continuation. */
|
||||||
|
+ while (*ptr && (*ptr & 0xc0) == 0x80)
|
||||||
|
+ ptr++;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
list = PyTuple_New(2);
|
||||||
|
PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
|
||||||
|
Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
|
||||||
|
- message = libxml_charPtrConstWrap(str);
|
||||||
|
+ message = libxml_charPtrConstWrap(ptr);
|
||||||
|
PyTuple_SetItem(list, 1, message);
|
||||||
|
result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
|
||||||
|
+ /* Forget any errors caused in the error handler. */
|
||||||
|
+ PyErr_Clear();
|
||||||
|
Py_XDECREF(list);
|
||||||
|
Py_XDECREF(result);
|
||||||
|
}
|
1849
libxml2.changes
Normal file
1849
libxml2.changes
Normal file
File diff suppressed because it is too large
Load diff
260
libxml2.spec
Normal file
260
libxml2.spec
Normal file
|
@ -0,0 +1,260 @@
|
||||||
|
#
|
||||||
|
# spec file for package libxml2
|
||||||
|
#
|
||||||
|
# Copyright (c) 2022-2023 ZhuningOS
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%define base_name libxml2
|
||||||
|
%define libname libxml2-2
|
||||||
|
%define flavor %nil
|
||||||
|
%if "%{flavor}" == "python"
|
||||||
|
%define dash -
|
||||||
|
%define buildpython 1
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%{?sle15allpythons}
|
||||||
|
Name: libxml2%{?dash}%{flavor}
|
||||||
|
Version: 2.10.3
|
||||||
|
Release: 150500.5.8.1
|
||||||
|
License: MIT
|
||||||
|
Summary: A Library to Manipulate XML Files
|
||||||
|
URL: https://gitlab.gnome.org/GNOME/libxml2
|
||||||
|
Source0: https://download.gnome.org/sources/%{name}/2.10/libxml2-%{version}.tar.xz
|
||||||
|
Source1: baselibs.conf
|
||||||
|
Source2: https://www.w3.org/XML/Test/xmlts20080827.tar.gz
|
||||||
|
#
|
||||||
|
### -- Upstream patches range from 0 to 999 -- ###
|
||||||
|
# PATCH-FIX-UPSTREAM libxml2-python3-unicode-errors.patch bsc#1064286 mcepl@suse.com
|
||||||
|
# remove segfault after doc.freeDoc()
|
||||||
|
Patch0: libxml2-python3-unicode-errors.patch
|
||||||
|
# PATCH-FIX-UPSTREAM libxml2-python3-string-null-check.patch bsc#1065270 mgorse@suse.com
|
||||||
|
# https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/15
|
||||||
|
Patch1: libxml2-python3-string-null-check.patch
|
||||||
|
# PATCH-FIX-UPSTREAM [CVE-2023-29469, bsc#1210412] Hashing of empty dict strings isn't deterministic
|
||||||
|
# https://gitlab.gnome.org/GNOME/libxml2/-/commit/09a2dd453007f9c7205274623acdd73747c22d64
|
||||||
|
Patch2: libxml2-CVE-2023-29469.patch
|
||||||
|
# PATCH-FIX-UPSTREAM [CVE-CVE-2023-28484, bsc#1210411] NULL dereference in xmlSchemaFixupComplexType
|
||||||
|
# https://gitlab.gnome.org/GNOME/libxml2/-/commit/647e072ea0a2f12687fa05c172f4c4713fdb0c4f
|
||||||
|
# https://gitlab.gnome.org/GNOME/libxml2/-/commit/4c6922f763ad958c48ff66f82823ae21f2e92ee6
|
||||||
|
Patch3: libxml2-CVE-2023-28484-1.patch
|
||||||
|
Patch4: libxml2-CVE-2023-28484-2.patch
|
||||||
|
# PATCH-FIX-UPSTREAM CVE-2023-39615 bsc#1214768
|
||||||
|
# https://gitlab.gnome.org/GNOME/libxml2/-/commit/d0c3f01e110d54415611c5fa0040cdf4a56053f9
|
||||||
|
Patch5: libxml2-CVE-2023-39615.patch
|
||||||
|
#
|
||||||
|
### -- openSUSE patches range from 1000 to 1999 -- ###
|
||||||
|
# PATCH-FIX-OPENSUSE
|
||||||
|
#Patch1000:
|
||||||
|
#
|
||||||
|
### -- SUSE patches starts from 2000 -- ###
|
||||||
|
## TODO -- Is libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch really
|
||||||
|
## SUSE-specific? If so, shouldn't it be applied only for SLE distributions?
|
||||||
|
# PATCH-FIX-SUSE bsc#1135123 Added a new configurable variable XPATH_DEFAULT_MAX_NODESET_LENGTH to avoid nodeset limit
|
||||||
|
Patch2000: libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch
|
||||||
|
#
|
||||||
|
BuildRequires: fdupes
|
||||||
|
BuildRequires: pkgconfig
|
||||||
|
BuildRequires: readline-devel
|
||||||
|
BuildRequires: pkgconfig(liblzma)
|
||||||
|
BuildRequires: pkgconfig(zlib)
|
||||||
|
%if 0%{?buildpython}
|
||||||
|
BuildRequires: %{python_module devel}
|
||||||
|
BuildRequires: %{python_module xml}
|
||||||
|
BuildRequires: python-rpm-macros
|
||||||
|
BuildRequires: pkgconfig(libxml-2.0)
|
||||||
|
# TW: generate subpackages for every python3 flavor
|
||||||
|
%define python_subpackage_only 1
|
||||||
|
%python_subpackages
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%description
|
||||||
|
The XML C library was initially developed for the GNOME project. It is
|
||||||
|
now used by many programs to load and save extensible data structures
|
||||||
|
or manipulate any kind of XML files.
|
||||||
|
|
||||||
|
%package -n %{libname}
|
||||||
|
Summary: A Library to Manipulate XML Files
|
||||||
|
|
||||||
|
%description -n %{libname}
|
||||||
|
The XML C library was initially developed for the GNOME project. It is
|
||||||
|
now used by many programs to load and save extensible data structures
|
||||||
|
or manipulate any kind of XML files.
|
||||||
|
|
||||||
|
This library implements a number of existing standards related to
|
||||||
|
markup languages, including the XML standard, name spaces in XML, XML
|
||||||
|
Base, RFC 2396, XPath, XPointer, HTML4, XInclude, SGML catalogs, and
|
||||||
|
XML catalogs. In most cases, libxml tries to implement the
|
||||||
|
specification in a rather strict way. To some extent, it provides
|
||||||
|
support for the following specifications, but does not claim to
|
||||||
|
implement them: DOM, FTP client, HTTP client, and SAX.
|
||||||
|
|
||||||
|
The library also supports RelaxNG. Support for W3C XML Schemas is in
|
||||||
|
progress.
|
||||||
|
|
||||||
|
%package tools
|
||||||
|
Summary: Tools using libxml
|
||||||
|
Provides: %{base_name} = %{version}-%{release}
|
||||||
|
# Use hardcoded version to avoid unwanted behavior in the future.
|
||||||
|
Obsoletes: %{base_name} < 2.9.13
|
||||||
|
|
||||||
|
%description tools
|
||||||
|
This package contains xmllint, a very useful tool proving libxml's power.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: Development files for libxml2, an XML manipulation library
|
||||||
|
Requires: %{base_name} = %{version}
|
||||||
|
Requires: %{base_name}-tools = %{version}
|
||||||
|
Requires: %{libname} = %{version}
|
||||||
|
Requires: glibc-devel
|
||||||
|
Requires: libxml2 = %{version}
|
||||||
|
Requires: readline-devel
|
||||||
|
Requires: xz-devel
|
||||||
|
Requires: zlib-devel
|
||||||
|
Requires: pkgconfig(liblzma)
|
||||||
|
Requires: pkgconfig(zlib)
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
The XML C library can load and save extensible data structures
|
||||||
|
or manipulate any kind of XML files.
|
||||||
|
|
||||||
|
This subpackage contains header files for developing
|
||||||
|
applications that want to make use of libxml.
|
||||||
|
|
||||||
|
%package doc
|
||||||
|
Summary: Documentation for libxml, an XML manipulation library
|
||||||
|
Requires: %{libname} = %{version}
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description doc
|
||||||
|
The XML C library was initially developed for the GNOME project. It is
|
||||||
|
now used by many programs to load and save extensible data structures
|
||||||
|
or manipulate any kind of XML files.
|
||||||
|
|
||||||
|
%package -n python-libxml2
|
||||||
|
Summary: Python Bindings for %{name}
|
||||||
|
Requires: %{libname} = %{version}
|
||||||
|
Requires: python-extras
|
||||||
|
Provides: %{base_name}-python = %{version}-%{release}
|
||||||
|
Provides: python-libxml2-python = %{version}-%{release}
|
||||||
|
# Use hardcoded version to avoid unwanted behavior in the future.
|
||||||
|
Obsoletes: %{base_name}-python < 2.9.13
|
||||||
|
Obsoletes: python-libxml2-python < 2.9.13
|
||||||
|
|
||||||
|
%description -n python-libxml2
|
||||||
|
This package contains a module that permits
|
||||||
|
applications written in the Python programming language to use the
|
||||||
|
interface supplied by the libxml2 library to manipulate XML files.
|
||||||
|
|
||||||
|
This library allows manipulation of XML files. It includes support for
|
||||||
|
reading, modifying, and writing XML and HTML files. There is DTD
|
||||||
|
support that includes parsing and validation even with complex DTDs,
|
||||||
|
either at parse time or later once the document has been modified.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1 -n libxml2-%{version}
|
||||||
|
sed -i '1 s|/usr/bin/env python|/usr/bin/python3|' doc/apibuild.py
|
||||||
|
|
||||||
|
%build
|
||||||
|
%if ! 0%{?buildpython}
|
||||||
|
# TODO -- Document why are we using the -fno-strict-aliasing extra flag.
|
||||||
|
export CFLAGS="%{optflags} -fno-strict-aliasing"
|
||||||
|
%configure \
|
||||||
|
--disable-silent-rules \
|
||||||
|
--disable-static \
|
||||||
|
--docdir=%{_docdir}/%{base_name} \
|
||||||
|
--with-html-dir=%{_docdir}/%{base_name}/html \
|
||||||
|
--without-python \
|
||||||
|
--with-fexceptions \
|
||||||
|
--with-history \
|
||||||
|
--enable-ipv6 \
|
||||||
|
--with-sax1 \
|
||||||
|
--with-regexps \
|
||||||
|
--with-threads \
|
||||||
|
--with-reader \
|
||||||
|
--with-ftp \
|
||||||
|
--with-http \
|
||||||
|
--with-legacy
|
||||||
|
|
||||||
|
%make_build BASE_DIR="%{_docdir}" DOC_MODULE="%{base_name}"
|
||||||
|
%else
|
||||||
|
%configure --with-python=%{__python3}
|
||||||
|
pushd python
|
||||||
|
%python_build
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%install
|
||||||
|
%if ! 0%{?buildpython}
|
||||||
|
%make_install BASE_DIR="%{_docdir}" DOC_MODULE="%{base_name}"
|
||||||
|
find %{buildroot} -type f -name "*.la" -delete -print
|
||||||
|
mkdir -p "%{buildroot}/%{_docdir}/%{base_name}"
|
||||||
|
cp -a NEWS README.md TODO* %{buildroot}%{_docdir}/%{base_name}/
|
||||||
|
ln -s libxml2/libxml %{buildroot}%{_includedir}/libxml
|
||||||
|
# Remove duplicated file Copyright as not found by fdupes
|
||||||
|
rm -fr %{buildroot}%{_docdir}/%{base_name}/Copyright
|
||||||
|
%fdupes %{buildroot}%{_datadir}
|
||||||
|
%else
|
||||||
|
pushd python
|
||||||
|
%python_install
|
||||||
|
popd
|
||||||
|
chmod a-x python/tests/*.py
|
||||||
|
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if ! 0%{?buildpython}
|
||||||
|
%check
|
||||||
|
# qemu-arm can't keep up atm, disabling check for arm
|
||||||
|
%ifnarch %{arm}
|
||||||
|
tar xzvf %{SOURCE2} # add conformance tests where they are expected
|
||||||
|
%make_build check
|
||||||
|
rm -rf %{_bindir}/xmlconf # remove conformance tests afterwards
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%ldconfig_scriptlets -n %{libname}
|
||||||
|
|
||||||
|
%files -n %{libname}
|
||||||
|
%{_libdir}/lib*.so.*
|
||||||
|
%license Copyright
|
||||||
|
%doc %dir %{_docdir}/%{base_name}
|
||||||
|
%doc %{_docdir}/%{base_name}/[ANRCT]*
|
||||||
|
|
||||||
|
# the -n %%base_name tag is necessary so that python_subpackages does not interfere
|
||||||
|
%files -n %{base_name}-tools
|
||||||
|
%{_bindir}/xmllint
|
||||||
|
%{_bindir}/xmlcatalog
|
||||||
|
%{_mandir}/man1/xmllint.1%{?ext_man}
|
||||||
|
%{_mandir}/man1/xmlcatalog.1%{?ext_man}
|
||||||
|
|
||||||
|
%files -n %{base_name}-devel
|
||||||
|
%{_bindir}/xml2-config
|
||||||
|
%dir %{_datadir}/aclocal
|
||||||
|
%{_datadir}/aclocal/libxml.m4
|
||||||
|
%{_includedir}/libxml
|
||||||
|
%{_includedir}/libxml2
|
||||||
|
%{_libdir}/lib*.so
|
||||||
|
%{_libdir}/pkgconfig/*.pc
|
||||||
|
%{_libdir}/cmake
|
||||||
|
%{_mandir}/man1/xml2-config.1%{?ext_man}
|
||||||
|
|
||||||
|
%files -n %{base_name}-doc
|
||||||
|
%{_datadir}/gtk-doc/html/*
|
||||||
|
%doc %{_docdir}/%{base_name}/examples
|
||||||
|
%doc %{_docdir}/%{base_name}/tutorial
|
||||||
|
%doc %{_docdir}/%{base_name}/*.html
|
||||||
|
# owning these directories prevents gtk-doc <-> libxml2 build loop:
|
||||||
|
%dir %{_datadir}/gtk-doc
|
||||||
|
%dir %{_datadir}/gtk-doc/html
|
||||||
|
|
||||||
|
%else
|
||||||
|
|
||||||
|
%files %{python_files libxml2}
|
||||||
|
%doc python/TODO
|
||||||
|
%doc python/libxml2class.txt
|
||||||
|
%doc doc/*.py
|
||||||
|
%doc python/README
|
||||||
|
%pycache_only %{python_sitearch}/__pycache__/*libxml2*
|
||||||
|
%{python_sitearch}/*libxml2*
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%changelog
|
Loading…
Add table
Reference in a new issue