summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-10-19 15:39:54 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-10-19 15:39:54 +0300
commit76d018a8af27653c40229684724c185830b1c482 (patch)
tree4765d32bae0948b8e929564d6eba54de1675b7a3 /debian
parent5beef1c7a526e014a37ca8a422911e574d3e6951 (diff)
parent76c19f4d5b3328c05649314336d27c1f44a49e96 (diff)
downloadlibxml2-76d018a8af27653c40229684724c185830b1c482.tar.gz
Merge branch 'master' of git://anonscm.debian.org/debian-xml-sgml/libxml2
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog44
-rw-r--r--debian/control10
-rw-r--r--debian/libxml2.symbols8
-rw-r--r--debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch40
-rw-r--r--debian/patches/0002-fix-python-multiarch-includes.patch8
-rw-r--r--debian/patches/0003-Fix-an-error-in-xmlCleanupParser.patch27
-rw-r--r--debian/patches/0003-Revert-Missing-initialization-for-the-catalog-module.patch25
-rw-r--r--debian/patches/0004-Fix-missing-break-on-last-function-for-attributes.patch21
-rw-r--r--debian/patches/0004-Fix-missing-entities-after-CVE-2014-3660-fix.patch27
-rw-r--r--debian/patches/0005-Account-for-ID-attributes-in-xmlSetTreeDoc.patch32
-rw-r--r--debian/patches/0005-xmllint-memory-should-fail-on-empty-files.patch27
-rw-r--r--debian/patches/0006-Stop-parsing-on-entities-boundaries-errors.patch28
-rw-r--r--debian/patches/0006-properly-quote-the-namespace-uris-written-out-during.patch32
-rw-r--r--debian/patches/0007-Cleanup-conditional-section-error-handling.patch45
-rw-r--r--debian/patches/0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch57
-rw-r--r--debian/patches/0008-Fix-order-of-root-nodes.patch29
-rw-r--r--debian/patches/0008-missing-else-in-xlink.c.patch22
-rw-r--r--debian/patches/0009-Catch-malloc-error-and-exit-accordingly.patch24
-rw-r--r--debian/patches/0009-xmlMemUsed-is-not-thread-safe.patch42
-rw-r--r--debian/patches/0010-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch172
-rw-r--r--debian/patches/0010-Fix-handling-of-mmap-errors.patch51
-rw-r--r--debian/patches/0011-Avoid-crash-if-allocation-fails.patch25
-rw-r--r--debian/patches/0011-Do-not-process-encoding-values-if-the-declaration-if.patch34
-rw-r--r--debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch31
-rw-r--r--debian/patches/0012-Fix-a-possible-NULL-dereference.patch30
-rw-r--r--debian/patches/0013-Clear-up-a-potential-NULL-dereference.patch26
-rw-r--r--debian/patches/0013-Fix-a-self-assignment-issue-raised-by-clang.patch40
-rw-r--r--debian/patches/0014-Fix-XPath-optimization-with-predicates.patch27
-rw-r--r--debian/patches/0014-Fix-previous-change-to-node-sort-order.patch33
-rw-r--r--debian/patches/0015-Fix-the-spurious-ID-already-defined-error.patch84
-rw-r--r--debian/patches/0015-xmllint-pretty-crashed-without-following-numeric-arg.patch34
-rw-r--r--debian/patches/0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch45
-rw-r--r--debian/patches/0017-Fix-a-potential-NULL-dereference-in-tree-code.patch26
-rw-r--r--debian/patches/0018-Fix-pointer-dereferenced-before-null-check.patch25
-rw-r--r--debian/patches/0019-Fix-a-bug-loading-some-compressed-files.patch69
-rw-r--r--debian/patches/0020-Avoid-a-possibility-of-dangling-encoding-handler.patch57
-rw-r--r--debian/patches/0021-Fix-a-couple-of-missing-NULL-checks.patch29
-rw-r--r--debian/patches/0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch148
-rw-r--r--debian/patches/0023-Handling-of-XPath-function-arguments-in-error-case.patch41
-rw-r--r--debian/patches/0024-Missing-initialization-for-the-catalog-module.patch22
-rw-r--r--debian/patches/0025-Fix-an-fd-leak-in-an-error-case.patch24
-rw-r--r--debian/patches/0026-fixing-a-ptotential-uninitialized-access.patch21
-rw-r--r--debian/patches/0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch29
-rw-r--r--debian/patches/0028-Avoid-a-possible-NULL-pointer-dereference.patch22
-rw-r--r--debian/patches/0029-Do-not-fetch-external-parameter-entities.patch35
-rw-r--r--debian/patches/0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch32
-rw-r--r--debian/patches/0031-xmllint-was-not-parsing-the-c14n11-flag.patch22
-rw-r--r--debian/patches/0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch58
-rw-r--r--debian/patches/series43
-rwxr-xr-xdebian/rules17
50 files changed, 715 insertions, 1185 deletions
diff --git a/debian/changelog b/debian/changelog
index 71cc016..840161d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,47 @@
+libxml2 (2.9.2+zdfsg1-4) unstable; urgency=medium
+
+ * Revert everything in N'ACKed NMU revert to 2.9.1.
+ - Resolving regression, Closes: #754424
+ - Drop the following NMU, not needed in 2.9.2, Closes: #781232
+ - Drop not approved patch for GNOME #746048
+ * Revert icu dbg drop, but don't hardcode version,
+ thanks Matthias Klose <doko>, Closes: #798642
+ * Cherry pick upstream post release patches:
+ - Fix for regression triggered by CVE-2014-3660, Closes: #768089
+ - Fix for the spurious ID already defined error, Closes: #766884
+ - Fix for CVE-2015-1819, Closes: #782782
+ - Fix for GNOME #744980, Closes: #783010
+ - Several fixes for memory related issues.
+
+ -- Aron Xu <aron@debian.org> Tue, 22 Sep 2015 16:31:48 +0800
+
+libxml2 (2.9.2+dfsg1-3) unstable; urgency=medium
+
+ * Add icu related deps for -dev and -dbg packages
+ (Closes: #776741)
+
+ -- Aron Xu <aron@debian.org> Sun, 01 Feb 2015 12:35:52 +0800
+
+libxml2 (2.9.2+dfsg1-2) unstable; urgency=medium
+
+ [ Michael Gilbert ]
+ * Enable icu support (Closes: #776254)
+
+ [ Aron Xu ]
+ * 0003-Fix-missing-entities-after-CVE-2014-3660-fix.patch:
+ Fix upstream bug triggered by CVE fix (Closes: #768089)
+
+ -- Aron Xu <aron@debian.org> Fri, 30 Jan 2015 13:52:23 +0800
+
+libxml2 (2.9.2+dfsg1-1) unstable; urgency=low
+
+ * New upstream release (Closes: #765722, CVE-2014-3660)
+ * Remove no-longer-needed upstream patches
+ * Update distro patch
+ * Std-ver: 3.9.5 -> 3.9.6, no change.
+
+ -- Aron Xu <aron@debian.org> Sun, 26 Oct 2014 07:04:50 +0800
+
libxml2 (2.9.1+dfsg1-4+dyson1) unstable; urgency=medium
* Package for Dyson
diff --git a/debian/control b/debian/control
index 8f0fb90..3f090f5 100644
--- a/debian/control
+++ b/debian/control
@@ -3,11 +3,11 @@ Priority: optional
Section: libs
Maintainer: Debian XML/SGML Group <debian-xml-sgml-pkgs@lists.alioth.debian.org>
Uploaders: Aron Xu <aron@debian.org>, YunQiang Su <wzssyqa@gmail.com>
-Standards-Version: 3.9.5
-Build-Depends: debhelper (>= 9), dh-autoreconf, autotools-dev,
+Standards-Version: 3.9.6
+Build-Depends: debhelper (>= 9), dh-autoreconf, autotools-dev, pkg-config,
libpython-all-dev, libpython-all-dbg,
python-all-dev:any (>= 2.7.5-5~), python-all-dbg:any,
- zlib1g-dev | libz-dev, liblzma-dev
+ zlib1g-dev | libz-dev, liblzma-dev, libicu-dev
Homepage: http://xmlsoft.org/
Vcs-Git: git://anonscm.debian.org/debian-xml-sgml/libxml2.git
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-xml-sgml/libxml2.git
@@ -94,7 +94,7 @@ Description: XML utilities (debug extension)
Package: libxml2-dev
Architecture: any
Section: libdevel
-Depends: libxml2 (= ${binary:Version}), ${misc:Depends}
+Depends: libxml2 (= ${binary:Version}), libicu-dev, ${misc:Depends}
Suggests: pkg-config
Multi-Arch: same
Description: Development files for the GNOME XML library
@@ -112,7 +112,7 @@ Package: libxml2-dbg
Architecture: any
Section: debug
Priority: extra
-Depends: libxml2 (= ${binary:Version}), ${misc:Depends}
+Depends: libxml2 (= ${binary:Version}), ${dep:libicudbg}, ${misc:Depends}
Multi-Arch: same
Description: Debugging symbols for the GNOME XML library
XML is a metalanguage to let you design your own markup language.
diff --git a/debian/libxml2.symbols b/debian/libxml2.symbols
index 374ef1d..f54051d 100644
--- a/debian/libxml2.symbols
+++ b/debian/libxml2.symbols
@@ -40,13 +40,13 @@ libxml2.so.2 libxml2 #MINVER#
(symver|optional)LIBXML2_2.8.0 2.8.0
(symver|optional)LIBXML2_2.9.0 2.9.0
(symver|optional)LIBXML2_2.9.1 2.9.1
+ (optional)__libxml2_xzclose@Base 2.8.0
+ (optional)__libxml2_xzdopen@Base 2.8.0
+ (optional)__libxml2_xzopen@Base 2.8.0
+ (optional)__libxml2_xzread@Base 2.8.0
__docbDefaultSAXHandler@Base 2.6.27
__htmlDefaultSAXHandler@Base 2.6.27
__htmlParseContent@Base 2.6.27
- __libxml2_xzclose@Base 2.8.0
- __libxml2_xzdopen@Base 2.8.0
- __libxml2_xzopen@Base 2.8.0
- __libxml2_xzread@Base 2.8.0
__oldXMLWDcompatibility@Base 2.6.27
__xmlBufferAllocScheme@Base 2.6.27
__xmlDefaultBufferSize@Base 2.6.27
diff --git a/debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch b/debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch
index c5b16bb..d5d3622 100644
--- a/debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch
+++ b/debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch
@@ -1,20 +1,19 @@
From: Aron Xu <aron@debian.org>
-Date: Fri, 21 Sep 2012 00:19:41 +0800
+Date: Sun, 26 Oct 2014 06:02:29 +0800
Subject: modify xml2-config and pkgconfig behaviour
---
- configure.in | 2 +-
- libxml-2.0-uninstalled.pc.in | 3 ++-
- libxml-2.0.pc.in | 2 +-
- xml2-config.1 | 4 ++++
- xml2-config.in | 22 ++++++++++------------
- 5 files changed, 18 insertions(+), 15 deletions(-)
+ configure.ac | 2 +-
+ libxml-2.0-uninstalled.pc.in | 3 ++-
+ xml2-config.1 | 4 ++++
+ xml2-config.in | 22 ++++++++++------------
+ 4 files changed, 17 insertions(+), 14 deletions(-)
-diff --git a/configure.in b/configure.in
-index d449b11..668f233 100644
---- a/configure.in
-+++ b/configure.in
-@@ -1380,7 +1380,7 @@ case "$host" in
+diff --git a/configure.ac b/configure.ac
+index 14ac0a8..21d90ab 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1476,7 +1476,7 @@ case "$host" in
*) M_LIBS="-lm"
;;
esac
@@ -24,28 +23,17 @@ index d449b11..668f233 100644
AC_SUBST(WITH_ICONV)
diff --git a/libxml-2.0-uninstalled.pc.in b/libxml-2.0-uninstalled.pc.in
-index cab6834..af16ebc 100644
+index 60b886b..0d5d6cb 100644
--- a/libxml-2.0-uninstalled.pc.in
+++ b/libxml-2.0-uninstalled.pc.in
@@ -8,5 +8,6 @@ Name: libXML
Version: @VERSION@
Description: libXML library version2.
Requires:
--Libs: -L${libdir} -lxml2 @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
+-Libs: -L${libdir} -lxml2 @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
+Libs: -L${libdir} -lxml2
-+Libs.private: @BASE_THREAD_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
++Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
Cflags: -I${includedir} @XML_INCLUDEDIR@ @XML_CFLAGS@
-diff --git a/libxml-2.0.pc.in b/libxml-2.0.pc.in
-index f5f5f03..0de667b 100644
---- a/libxml-2.0.pc.in
-+++ b/libxml-2.0.pc.in
-@@ -9,5 +9,5 @@ Version: @VERSION@
- Description: libXML library version2.
- Requires:
- Libs: -L${libdir} -lxml2
--Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
-+Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@ @LZMA_LIBS@
- Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@
diff --git a/xml2-config.1 b/xml2-config.1
index 8cf9858..7b4195d 100644
--- a/xml2-config.1
diff --git a/debian/patches/0002-fix-python-multiarch-includes.patch b/debian/patches/0002-fix-python-multiarch-includes.patch
index ff7c4fa..bcab67e 100644
--- a/debian/patches/0002-fix-python-multiarch-includes.patch
+++ b/debian/patches/0002-fix-python-multiarch-includes.patch
@@ -3,8 +3,8 @@ Date: Wed, 9 Jul 2014 05:30:24 +0800
Subject: fix python multiarch includes
---
- python/Makefile.am | 2 +-
- python/Makefile.in | 2 +-
+ python/Makefile.am | 2 +-
+ python/Makefile.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/Makefile.am b/python/Makefile.am
@@ -21,10 +21,10 @@ index 34aed96..8445ea5 100644
python_LTLIBRARIES = libxml2mod.la
diff --git a/python/Makefile.in b/python/Makefile.in
-index efdea43..23e7fa2 100644
+index 03fbd5b..7299c82 100644
--- a/python/Makefile.in
+++ b/python/Makefile.in
-@@ -430,7 +430,7 @@ EXTRA_DIST = \
+@@ -490,7 +490,7 @@ EXTRA_DIST = \
@WITH_PYTHON_TRUE@AM_CPPFLAGS = \
@WITH_PYTHON_TRUE@ -I$(top_builddir)/include \
@WITH_PYTHON_TRUE@ -I$(top_srcdir)/include \
diff --git a/debian/patches/0003-Fix-an-error-in-xmlCleanupParser.patch b/debian/patches/0003-Fix-an-error-in-xmlCleanupParser.patch
deleted file mode 100644
index 03bf447..0000000
--- a/debian/patches/0003-Fix-an-error-in-xmlCleanupParser.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From: Alexander Pastukhov <pastuchov@yandex.ru>
-Date: Tue, 23 Apr 2013 05:02:11 +0000
-Subject: Fix an error in xmlCleanupParser
-
-https://bugzilla.gnome.org/show_bug.cgi?id=698582
-
-xmlCleanupParser calls xmlCleanupGlobals() and then
-xmlResetLastError() but the later reallocate the global
-data freed by previous call. Just swap the two calls.
----
- parser.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/parser.c b/parser.c
-index ee429f3..b9df6d8 100644
---- a/parser.c
-+++ b/parser.c
-@@ -14763,8 +14763,8 @@ xmlCleanupParser(void) {
- xmlSchemaCleanupTypes();
- xmlRelaxNGCleanupTypes();
- #endif
-- xmlCleanupGlobals();
- xmlResetLastError();
-+ xmlCleanupGlobals();
- xmlCleanupThreads(); /* must be last if called not from the main thread */
- xmlCleanupMemory();
- xmlParserInitialized = 0;
diff --git a/debian/patches/0003-Revert-Missing-initialization-for-the-catalog-module.patch b/debian/patches/0003-Revert-Missing-initialization-for-the-catalog-module.patch
new file mode 100644
index 0000000..d04a773
--- /dev/null
+++ b/debian/patches/0003-Revert-Missing-initialization-for-the-catalog-module.patch
@@ -0,0 +1,25 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Fri, 17 Oct 2014 17:13:41 +0800
+Subject: Revert "Missing initialization for the catalog module"
+
+This reverts commit 054c716ea1bf001544127a4ab4f4346d1b9947e7.
+As this break xmlcatalog command
+https://bugzilla.redhat.com/show_bug.cgi?id=1153753
+---
+ parser.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/parser.c b/parser.c
+index 1d93967..67c9dfd 100644
+--- a/parser.c
++++ b/parser.c
+@@ -14830,9 +14830,6 @@ xmlInitParser(void) {
+ #ifdef LIBXML_XPATH_ENABLED
+ xmlXPathInit();
+ #endif
+-#ifdef LIBXML_CATALOG_ENABLED
+- xmlInitializeCatalog();
+-#endif
+ xmlParserInitialized = 1;
+ #ifdef LIBXML_THREAD_ENABLED
+ }
diff --git a/debian/patches/0004-Fix-missing-break-on-last-function-for-attributes.patch b/debian/patches/0004-Fix-missing-break-on-last-function-for-attributes.patch
deleted file mode 100644
index cff8b72..0000000
--- a/debian/patches/0004-Fix-missing-break-on-last-function-for-attributes.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From: dcb <dcb314@hotmail.com>
-Date: Thu, 2 May 2013 08:11:46 +0000
-Subject: Fix missing break on last() function for attributes
-
-pointed out by cppcheck
----
- python/libxml.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/python/libxml.c b/python/libxml.c
-index 03cfb9f..3338b83 100644
---- a/python/libxml.c
-+++ b/python/libxml.c
-@@ -2683,6 +2683,7 @@ libxml_last(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
- xmlAttrPtr attr = (xmlAttrPtr) cur;
-
- res = attr->last;
-+ break;
- }
- default:
- res = NULL;
diff --git a/debian/patches/0004-Fix-missing-entities-after-CVE-2014-3660-fix.patch b/debian/patches/0004-Fix-missing-entities-after-CVE-2014-3660-fix.patch
new file mode 100644
index 0000000..01e131d
--- /dev/null
+++ b/debian/patches/0004-Fix-missing-entities-after-CVE-2014-3660-fix.patch
@@ -0,0 +1,27 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 23 Oct 2014 11:35:36 +0800
+Subject: Fix missing entities after CVE-2014-3660 fix
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=738805
+
+The fix for CVE-2014-3660 introduced a regression in some case
+where entity substitution is required and the entity is used
+first in anotther entity referenced from an attribute value
+---
+ parser.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/parser.c b/parser.c
+index 67c9dfd..a8d1b67 100644
+--- a/parser.c
++++ b/parser.c
+@@ -7235,7 +7235,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
+ * far more secure as the parser will only process data coming from
+ * the document entity by default.
+ */
+- if ((ent->checked == 0) &&
++ if (((ent->checked == 0) ||
++ ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) &&
+ ((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) ||
+ (ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) {
+ unsigned long oldnbent = ctxt->nbentities;
diff --git a/debian/patches/0005-Account-for-ID-attributes-in-xmlSetTreeDoc.patch b/debian/patches/0005-Account-for-ID-attributes-in-xmlSetTreeDoc.patch
new file mode 100644
index 0000000..18d7720
--- /dev/null
+++ b/debian/patches/0005-Account-for-ID-attributes-in-xmlSetTreeDoc.patch
@@ -0,0 +1,32 @@
+From: Nick Wellnhofer <wellnhofer@aevum.de>
+Date: Fri, 19 Dec 2014 00:08:35 +0100
+Subject: Account for ID attributes in xmlSetTreeDoc
+
+---
+ tree.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/tree.c b/tree.c
+index 307782c..ff9a890 100644
+--- a/tree.c
++++ b/tree.c
+@@ -2799,8 +2799,19 @@ xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
+ if(tree->type == XML_ELEMENT_NODE) {
+ prop = tree->properties;
+ while (prop != NULL) {
++ if (prop->atype == XML_ATTRIBUTE_ID) {
++ xmlRemoveID(tree->doc, prop);
++ }
++
+ prop->doc = doc;
+ xmlSetListDoc(prop->children, doc);
++
++ if (xmlIsID(doc, tree, prop)) {
++ xmlChar *idVal = xmlNodeListGetString(doc, prop->children,
++ 1);
++ xmlAddID(NULL, doc, idVal, prop);
++ }
++
+ prop = prop->next;
+ }
+ }
diff --git a/debian/patches/0005-xmllint-memory-should-fail-on-empty-files.patch b/debian/patches/0005-xmllint-memory-should-fail-on-empty-files.patch
deleted file mode 100644
index e1a2197..0000000
--- a/debian/patches/0005-xmllint-memory-should-fail-on-empty-files.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Wed, 8 May 2013 05:45:48 +0000
-Subject: xmllint --memory should fail on empty files
-
-Exposed by https://bugzilla.gnome.org/show_bug.cgi?id=699896
-when doing analysis but a priori unrelated.
----
- xmllint.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/xmllint.c b/xmllint.c
-index 26d8db1..c0196ab 100644
---- a/xmllint.c
-+++ b/xmllint.c
-@@ -2338,8 +2338,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
- if ((fd = open(filename, O_RDONLY)) < 0)
- return;
- base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
-- if (base == (void *) MAP_FAILED)
-+ if (base == (void *) MAP_FAILED) {
-+ fprintf(stderr, "mmap failure for file %s\n", filename);
-+ progresult = XMLLINT_ERR_RDFILE;
- return;
-+ }
-
- if (rectxt == NULL)
- doc = xmlReadMemory((char *) base, info.st_size,
diff --git a/debian/patches/0006-Stop-parsing-on-entities-boundaries-errors.patch b/debian/patches/0006-Stop-parsing-on-entities-boundaries-errors.patch
new file mode 100644
index 0000000..00cca9d
--- /dev/null
+++ b/debian/patches/0006-Stop-parsing-on-entities-boundaries-errors.patch
@@ -0,0 +1,28 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Mon, 23 Feb 2015 11:17:35 +0800
+Subject: Stop parsing on entities boundaries errors
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=744980
+
+There are times, like on unterminated entities that it's preferable to
+stop parsing, even if that means less error reporting. Entities are
+feeding the parser on further processing, and if they are ill defined
+then it's possible to get the parser to bug. Also do the same on
+Conditional Sections if the input is broken, as the structure of
+the document can't be guessed.
+---
+ parser.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/parser.c b/parser.c
+index a8d1b67..bbe97eb 100644
+--- a/parser.c
++++ b/parser.c
+@@ -5658,6 +5658,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
+ if (RAW != '>') {
+ xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
+ "xmlParseEntityDecl: entity %s not terminated\n", name);
++ xmlStopParser(ctxt);
+ } else {
+ if (input != ctxt->input) {
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
diff --git a/debian/patches/0006-properly-quote-the-namespace-uris-written-out-during.patch b/debian/patches/0006-properly-quote-the-namespace-uris-written-out-during.patch
deleted file mode 100644
index 6f4c4c8..0000000
--- a/debian/patches/0006-properly-quote-the-namespace-uris-written-out-during.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From: Aleksey Sanin <aleksey@aleksey.com>
-Date: Thu, 9 May 2013 16:02:16 +0000
-Subject: properly quote the namespace uris written out during c14n
-
----
- c14n.c | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/c14n.c b/c14n.c
-index afd95b3..ca77f92 100644
---- a/c14n.c
-+++ b/c14n.c
-@@ -547,14 +547,15 @@ xmlC14NPrintNamespaces(const xmlNsPtr ns, xmlC14NCtxPtr ctx)
- if (ns->prefix != NULL) {
- xmlOutputBufferWriteString(ctx->buf, " xmlns:");
- xmlOutputBufferWriteString(ctx->buf, (const char *) ns->prefix);
-- xmlOutputBufferWriteString(ctx->buf, "=\"");
-+ xmlOutputBufferWriteString(ctx->buf, "=");
- } else {
-- xmlOutputBufferWriteString(ctx->buf, " xmlns=\"");
-+ xmlOutputBufferWriteString(ctx->buf, " xmlns=");
- }
- if(ns->href != NULL) {
-- xmlOutputBufferWriteString(ctx->buf, (const char *) ns->href);
-+ xmlBufWriteQuotedString(ctx->buf->buffer, ns->href);
-+ } else {
-+ xmlOutputBufferWriteString(ctx->buf, "\"\"");
- }
-- xmlOutputBufferWriteString(ctx->buf, "\"");
- return (1);
- }
-
diff --git a/debian/patches/0007-Cleanup-conditional-section-error-handling.patch b/debian/patches/0007-Cleanup-conditional-section-error-handling.patch
new file mode 100644
index 0000000..0c8492c
--- /dev/null
+++ b/debian/patches/0007-Cleanup-conditional-section-error-handling.patch
@@ -0,0 +1,45 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Mon, 23 Feb 2015 11:29:20 +0800
+Subject: Cleanup conditional section error handling
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=744980
+
+The error handling of Conditional Section also need to be
+straightened as the structure of the document can't be
+guessed on a failure there and it's better to stop parsing
+as further errors are likely to be irrelevant.
+---
+ parser.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/parser.c b/parser.c
+index bbe97eb..fe603ac 100644
+--- a/parser.c
++++ b/parser.c
+@@ -6770,6 +6770,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
+ SKIP_BLANKS;
+ if (RAW != '[') {
+ xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
++ xmlStopParser(ctxt);
++ return;
+ } else {
+ if (ctxt->input->id != id) {
+ xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
+@@ -6830,6 +6832,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
+ SKIP_BLANKS;
+ if (RAW != '[') {
+ xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
++ xmlStopParser(ctxt);
++ return;
+ } else {
+ if (ctxt->input->id != id) {
+ xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
+@@ -6885,6 +6889,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
+
+ } else {
+ xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
++ xmlStopParser(ctxt);
++ return;
+ }
+
+ if (RAW == 0)
diff --git a/debian/patches/0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch b/debian/patches/0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch
deleted file mode 100644
index 442fd11..0000000
--- a/debian/patches/0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Wed, 22 May 2013 20:56:45 +0000
-Subject: Fix a parsing bug on non-ascii element and CR/LF usage
-
-https://bugzilla.gnome.org/show_bug.cgi?id=698550
-
-Somehow the behaviour of the internal parser routine changed
-slightly when encountering CR/LF, which led to a bug when
-parsing document with non-ascii Names
----
- parser.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/parser.c b/parser.c
-index b9df6d8..dd00399 100644
---- a/parser.c
-+++ b/parser.c
-@@ -3404,6 +3404,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
- int len = 0, l;
- int c;
- int count = 0;
-+ const xmlChar *end; /* needed because CUR_CHAR() can move cur on \r\n */
-
- #ifdef DEBUG
- nbParseNCNameComplex++;
-@@ -3413,6 +3414,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
- * Handler for more complex cases
- */
- GROW;
-+ end = ctxt->input->cur;
- c = CUR_CHAR(l);
- if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
- (!xmlIsNameStartChar(ctxt, c) || (c == ':'))) {
-@@ -3434,12 +3436,14 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
- }
- len += l;
- NEXTL(l);
-+ end = ctxt->input->cur;
- c = CUR_CHAR(l);
- if (c == 0) {
- count = 0;
- GROW;
- if (ctxt->instate == XML_PARSER_EOF)
- return(NULL);
-+ end = ctxt->input->cur;
- c = CUR_CHAR(l);
- }
- }
-@@ -3448,7 +3452,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
- xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
- return(NULL);
- }
-- return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
-+ return(xmlDictLookup(ctxt->dict, end - len, len));
- }
-
- /**
diff --git a/debian/patches/0008-Fix-order-of-root-nodes.patch b/debian/patches/0008-Fix-order-of-root-nodes.patch
new file mode 100644
index 0000000..171c3da
--- /dev/null
+++ b/debian/patches/0008-Fix-order-of-root-nodes.patch
@@ -0,0 +1,29 @@
+From: Nick Wellnhofer <wellnhofer@aevum.de>
+Date: Sun, 8 Mar 2015 16:44:11 +0100
+Subject: Fix order of root nodes
+
+Make sure root nodes are sorted before other nodes.
+---
+ xpath.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/xpath.c b/xpath.c
+index dc41ce6..95559b3 100644
+--- a/xpath.c
++++ b/xpath.c
+@@ -361,13 +361,13 @@ turtle_comparison:
+ /*
+ * compute depth to root
+ */
+- for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) {
++ for (depth2 = 0, cur = node2; cur != NULL; cur = cur->parent) {
+ if (cur == node1)
+ return(1);
+ depth2++;
+ }
+ root = cur;
+- for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) {
++ for (depth1 = 0, cur = node1; cur != NULL; cur = cur->parent) {
+ if (cur == node2)
+ return(-1);
+ depth1++;
diff --git a/debian/patches/0008-missing-else-in-xlink.c.patch b/debian/patches/0008-missing-else-in-xlink.c.patch
deleted file mode 100644
index 88a4e86..0000000
--- a/debian/patches/0008-missing-else-in-xlink.c.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From: Ami Fischman <fischman@google.com>
-Date: Tue, 2 Jul 2013 09:47:26 +0800
-Subject: missing else in xlink.c
-
-Obviously forgotten
----
- xlink.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/xlink.c b/xlink.c
-index 3566e06..c0e4ff3 100644
---- a/xlink.c
-+++ b/xlink.c
-@@ -150,7 +150,7 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
- if (type != NULL) {
- if (xmlStrEqual(type, BAD_CAST "simple")) {
- ret = XLINK_TYPE_SIMPLE;
-- } if (xmlStrEqual(type, BAD_CAST "extended")) {
-+ } else if (xmlStrEqual(type, BAD_CAST "extended")) {
- role = xmlGetNsProp(node, BAD_CAST "role", XLINK_NAMESPACE);
- if (role != NULL) {
- xmlNsPtr xlink;
diff --git a/debian/patches/0009-Catch-malloc-error-and-exit-accordingly.patch b/debian/patches/0009-Catch-malloc-error-and-exit-accordingly.patch
deleted file mode 100644
index 3f93a57..0000000
--- a/debian/patches/0009-Catch-malloc-error-and-exit-accordingly.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Thu, 11 Jul 2013 15:41:22 +0800
-Subject: Catch malloc error and exit accordingly
-
-As pointed privately by Bill Parker <wp02855@gmail.com>
----
- xmllint.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/xmllint.c b/xmllint.c
-index c0196ab..4d464e4 100644
---- a/xmllint.c
-+++ b/xmllint.c
-@@ -3090,6 +3090,10 @@ static void usage(const char *name) {
- static void registerNode(xmlNodePtr node)
- {
- node->_private = malloc(sizeof(long));
-+ if (node->_private == NULL) {
-+ fprintf(stderr, "Out of memory in xmllint:registerNode()\n");
-+ exit(XMLLINT_ERR_MEM);
-+ }
- *(long*)node->_private = (long) 0x81726354;
- nbregister++;
- }
diff --git a/debian/patches/0009-xmlMemUsed-is-not-thread-safe.patch b/debian/patches/0009-xmlMemUsed-is-not-thread-safe.patch
new file mode 100644
index 0000000..03a8f4f
--- /dev/null
+++ b/debian/patches/0009-xmlMemUsed-is-not-thread-safe.patch
@@ -0,0 +1,42 @@
+From: Martin von Gagern <Martin.vGagern@gmx.net>
+Date: Mon, 13 Apr 2015 16:32:14 +0800
+Subject: xmlMemUsed is not thread-safe
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=747437
+just use the mutex to protect access to those variables
+---
+ xmlmemory.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/xmlmemory.c b/xmlmemory.c
+index a3dc737..f24fd6d 100644
+--- a/xmlmemory.c
++++ b/xmlmemory.c
+@@ -554,7 +554,12 @@ xmlMemoryStrdup(const char *str) {
+
+ int
+ xmlMemUsed(void) {
+- return(debugMemSize);
++ int res;
++
++ xmlMutexLock(xmlMemMutex);
++ res = debugMemSize;
++ xmlMutexUnlock(xmlMemMutex);
++ return(res);
+ }
+
+ /**
+@@ -567,7 +572,12 @@ xmlMemUsed(void) {
+
+ int
+ xmlMemBlocks(void) {
+- return(debugMemBlocks);
++ int res;
++
++ xmlMutexLock(xmlMemMutex);
++ res = debugMemBlocks;
++ xmlMutexUnlock(xmlMemMutex);
++ return(res);
+ }
+
+ #ifdef MEM_LIST
diff --git a/debian/patches/0010-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch b/debian/patches/0010-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
new file mode 100644
index 0000000..14d3032
--- /dev/null
+++ b/debian/patches/0010-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
@@ -0,0 +1,172 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Tue, 14 Apr 2015 17:41:48 +0800
+Subject: CVE-2015-1819 Enforce the reader to run in constant memory
+
+One of the operation on the reader could resolve entities
+leading to the classic expansion issue. Make sure the
+buffer used for xmlreader operation is bounded.
+Introduce a new allocation type for the buffers for this effect.
+---
+ buf.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
+ include/libxml/tree.h | 3 ++-
+ xmlreader.c | 20 +++++++++++++++++++-
+ 3 files changed, 63 insertions(+), 3 deletions(-)
+
+diff --git a/buf.c b/buf.c
+index 6efc7b6..07922ff 100644
+--- a/buf.c
++++ b/buf.c
+@@ -27,6 +27,7 @@
+ #include <libxml/tree.h>
+ #include <libxml/globals.h>
+ #include <libxml/tree.h>
++#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
+ #include "buf.h"
+
+ #define WITH_BUFFER_COMPAT
+@@ -299,7 +300,8 @@ xmlBufSetAllocationScheme(xmlBufPtr buf,
+ if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
+ (scheme == XML_BUFFER_ALLOC_EXACT) ||
+ (scheme == XML_BUFFER_ALLOC_HYBRID) ||
+- (scheme == XML_BUFFER_ALLOC_IMMUTABLE)) {
++ (scheme == XML_BUFFER_ALLOC_IMMUTABLE) ||
++ (scheme == XML_BUFFER_ALLOC_BOUNDED)) {
+ buf->alloc = scheme;
+ if (buf->buffer)
+ buf->buffer->alloc = scheme;
+@@ -458,6 +460,18 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
+ size = buf->use + len + 100;
+ #endif
+
++ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
++ /*
++ * Used to provide parsing limits
++ */
++ if ((buf->use + len >= XML_MAX_TEXT_LENGTH) ||
++ (buf->size >= XML_MAX_TEXT_LENGTH)) {
++ xmlBufMemoryError(buf, "buffer error: text too long\n");
++ return(0);
++ }
++ if (size >= XML_MAX_TEXT_LENGTH)
++ size = XML_MAX_TEXT_LENGTH;
++ }
+ if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
+ size_t start_buf = buf->content - buf->contentIO;
+
+@@ -739,6 +753,15 @@ xmlBufResize(xmlBufPtr buf, size_t size)
+ CHECK_COMPAT(buf)
+
+ if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
++ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
++ /*
++ * Used to provide parsing limits
++ */
++ if (size >= XML_MAX_TEXT_LENGTH) {
++ xmlBufMemoryError(buf, "buffer error: text too long\n");
++ return(0);
++ }
++ }
+
+ /* Don't resize if we don't have to */
+ if (size < buf->size)
+@@ -867,6 +890,15 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
+
+ needSize = buf->use + len + 2;
+ if (needSize > buf->size){
++ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
++ /*
++ * Used to provide parsing limits
++ */
++ if (needSize >= XML_MAX_TEXT_LENGTH) {
++ xmlBufMemoryError(buf, "buffer error: text too long\n");
++ return(-1);
++ }
++ }
+ if (!xmlBufResize(buf, needSize)){
+ xmlBufMemoryError(buf, "growing buffer");
+ return XML_ERR_NO_MEMORY;
+@@ -938,6 +970,15 @@ xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) {
+ }
+ needSize = buf->use + len + 2;
+ if (needSize > buf->size){
++ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
++ /*
++ * Used to provide parsing limits
++ */
++ if (needSize >= XML_MAX_TEXT_LENGTH) {
++ xmlBufMemoryError(buf, "buffer error: text too long\n");
++ return(-1);
++ }
++ }
+ if (!xmlBufResize(buf, needSize)){
+ xmlBufMemoryError(buf, "growing buffer");
+ return XML_ERR_NO_MEMORY;
+diff --git a/include/libxml/tree.h b/include/libxml/tree.h
+index 2f90717..4a9b3bc 100644
+--- a/include/libxml/tree.h
++++ b/include/libxml/tree.h
+@@ -76,7 +76,8 @@ typedef enum {
+ XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */
+ XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
+ XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */
+- XML_BUFFER_ALLOC_HYBRID /* exact up to a threshold, and doubleit thereafter */
++ XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */
++ XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */
+ } xmlBufferAllocationScheme;
+
+ /**
+diff --git a/xmlreader.c b/xmlreader.c
+index f19e123..471e7e2 100644
+--- a/xmlreader.c
++++ b/xmlreader.c
+@@ -2091,6 +2091,9 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
+ "xmlNewTextReader : malloc failed\n");
+ return(NULL);
+ }
++ /* no operation on a reader should require a huge buffer */
++ xmlBufSetAllocationScheme(ret->buffer,
++ XML_BUFFER_ALLOC_BOUNDED);
+ ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
+ if (ret->sax == NULL) {
+ xmlBufFree(ret->buffer);
+@@ -3616,6 +3619,7 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
+ return(((xmlNsPtr) node)->href);
+ case XML_ATTRIBUTE_NODE:{
+ xmlAttrPtr attr = (xmlAttrPtr) node;
++ const xmlChar *ret;
+
+ if ((attr->children != NULL) &&
+ (attr->children->type == XML_TEXT_NODE) &&
+@@ -3629,10 +3633,21 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
+ "xmlTextReaderSetup : malloc failed\n");
+ return (NULL);
+ }
++ xmlBufSetAllocationScheme(reader->buffer,
++ XML_BUFFER_ALLOC_BOUNDED);
+ } else
+ xmlBufEmpty(reader->buffer);
+ xmlBufGetNodeContent(reader->buffer, node);
+- return(xmlBufContent(reader->buffer));
++ ret = xmlBufContent(reader->buffer);
++ if (ret == NULL) {
++ /* error on the buffer best to reallocate */
++ xmlBufFree(reader->buffer);
++ reader->buffer = xmlBufCreateSize(100);
++ xmlBufSetAllocationScheme(reader->buffer,
++ XML_BUFFER_ALLOC_BOUNDED);
++ ret = BAD_CAST "";
++ }
++ return(ret);
+ }
+ break;
+ }
+@@ -5131,6 +5146,9 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
+ "xmlTextReaderSetup : malloc failed\n");
+ return (-1);
+ }
++ /* no operation on a reader should require a huge buffer */
++ xmlBufSetAllocationScheme(reader->buffer,
++ XML_BUFFER_ALLOC_BOUNDED);
+ if (reader->sax == NULL)
+ reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
+ if (reader->sax == NULL) {
diff --git a/debian/patches/0010-Fix-handling-of-mmap-errors.patch b/debian/patches/0010-Fix-handling-of-mmap-errors.patch
deleted file mode 100644
index 0c55cfe..0000000
--- a/debian/patches/0010-Fix-handling-of-mmap-errors.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Fri, 12 Jul 2013 12:08:40 +0800
-Subject: Fix handling of mmap errors
-
-https://bugzilla.gnome.org/show_bug.cgi?id=702320
-
-as raised by Gaurav <ya1gaurav@gmail.com>
----
- xmllint.c | 13 +++++++++++--
- 1 file changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/xmllint.c b/xmllint.c
-index 4d464e4..92e6b03 100644
---- a/xmllint.c
-+++ b/xmllint.c
-@@ -1837,8 +1837,12 @@ static void streamFile(char *filename) {
- if ((fd = open(filename, O_RDONLY)) < 0)
- return;
- base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
-- if (base == (void *) MAP_FAILED)
-+ if (base == (void *) MAP_FAILED) {
-+ close(fd);
-+ fprintf(stderr, "mmap failure for file %s\n", filename);
-+ progresult = XMLLINT_ERR_RDFILE;
- return;
-+ }
-
- reader = xmlReaderForMemory(base, info.st_size, filename,
- NULL, options);
-@@ -2223,8 +2227,12 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
- if ((fd = open(filename, O_RDONLY)) < 0)
- return;
- base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
-- if (base == (void *) MAP_FAILED)
-+ if (base == (void *) MAP_FAILED) {
-+ close(fd);
-+ fprintf(stderr, "mmap failure for file %s\n", filename);
-+ progresult = XMLLINT_ERR_RDFILE;
- return;
-+ }
-
- doc = htmlReadMemory((char *) base, info.st_size, filename,
- NULL, options);
-@@ -2339,6 +2347,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
- return;
- base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
- if (base == (void *) MAP_FAILED) {
-+ close(fd);
- fprintf(stderr, "mmap failure for file %s\n", filename);
- progresult = XMLLINT_ERR_RDFILE;
- return;
diff --git a/debian/patches/0011-Avoid-crash-if-allocation-fails.patch b/debian/patches/0011-Avoid-crash-if-allocation-fails.patch
deleted file mode 100644
index e4e7206..0000000
--- a/debian/patches/0011-Avoid-crash-if-allocation-fails.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Mon, 22 Jul 2013 14:28:20 +0800
-Subject: Avoid crash if allocation fails
-
-https://bugzilla.gnome.org/show_bug.cgi?id=704527
-xmlSchemaNewValue() may fail on OOM error
----
- xmlschemastypes.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/xmlschemastypes.c b/xmlschemastypes.c
-index a9edc03..ec403e8 100644
---- a/xmlschemastypes.c
-+++ b/xmlschemastypes.c
-@@ -242,6 +242,10 @@ xmlSchemaNewMinLengthFacet(int value)
- }
- ret->type = XML_SCHEMA_FACET_MINLENGTH;
- ret->val = xmlSchemaNewValue(XML_SCHEMAS_NNINTEGER);
-+ if (ret->val == NULL) {
-+ xmlFree(ret);
-+ return(NULL);
-+ }
- ret->val->value.decimal.lo = value;
- return (ret);
- }
diff --git a/debian/patches/0011-Do-not-process-encoding-values-if-the-declaration-if.patch b/debian/patches/0011-Do-not-process-encoding-values-if-the-declaration-if.patch
new file mode 100644
index 0000000..386ab1e
--- /dev/null
+++ b/debian/patches/0011-Do-not-process-encoding-values-if-the-declaration-if.patch
@@ -0,0 +1,34 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Mon, 29 Jun 2015 09:08:25 +0800
+Subject: Do not process encoding values if the declaration if broken
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=751603
+
+If the string is not properly terminated do not try to convert
+to the given encoding.
+---
+ parser.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/parser.c b/parser.c
+index fe603ac..a3a9568 100644
+--- a/parser.c
++++ b/parser.c
+@@ -10404,6 +10404,8 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
+ encoding = xmlParseEncName(ctxt);
+ if (RAW != '"') {
+ xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL);
++ xmlFree((xmlChar *) encoding);
++ return(NULL);
+ } else
+ NEXT;
+ } else if (RAW == '\''){
+@@ -10411,6 +10413,8 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
+ encoding = xmlParseEncName(ctxt);
+ if (RAW != '\'') {
+ xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL);
++ xmlFree((xmlChar *) encoding);
++ return(NULL);
+ } else
+ NEXT;
+ } else {
diff --git a/debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch b/debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch
new file mode 100644
index 0000000..d065088
--- /dev/null
+++ b/debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch
@@ -0,0 +1,31 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Mon, 29 Jun 2015 16:10:26 +0800
+Subject: Fail parsing early on if encoding conversion failed
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=751631
+
+If we fail conversing the current input stream while
+processing the encoding declaration of the XMLDecl
+then it's safer to just abort there and not try to
+report further errors.
+---
+ parser.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/parser.c b/parser.c
+index a3a9568..0edd53b 100644
+--- a/parser.c
++++ b/parser.c
+@@ -10471,7 +10471,11 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
+
+ handler = xmlFindCharEncodingHandler((const char *) encoding);
+ if (handler != NULL) {
+- xmlSwitchToEncoding(ctxt, handler);
++ if (xmlSwitchToEncoding(ctxt, handler) < 0) {
++ /* failed to convert */
++ ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
++ return(NULL);
++ }
+ } else {
+ xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
+ "Unsupported encoding %s\n", encoding);
diff --git a/debian/patches/0012-Fix-a-possible-NULL-dereference.patch b/debian/patches/0012-Fix-a-possible-NULL-dereference.patch
deleted file mode 100644
index 9a7cf6f..0000000
--- a/debian/patches/0012-Fix-a-possible-NULL-dereference.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: Gaurav <g.gupta@40samsung.com>
-Date: Sat, 3 Aug 2013 22:16:02 +0800
-Subject: Fix a possible NULL dereference
-
-https://bugzilla.gnome.org/show_bug.cgi?id=705400
-In case of allocation error the pointer was dereferenced before the
-test for a failure
----
- SAX2.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/SAX2.c b/SAX2.c
-index 4adf202..33d167e 100644
---- a/SAX2.c
-+++ b/SAX2.c
-@@ -994,12 +994,12 @@ xmlSAX2StartDocument(void *ctx)
- #ifdef LIBXML_HTML_ENABLED
- if (ctxt->myDoc == NULL)
- ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
-- ctxt->myDoc->properties = XML_DOC_HTML;
-- ctxt->myDoc->parseFlags = ctxt->options;
- if (ctxt->myDoc == NULL) {
- xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument");
- return;
- }
-+ ctxt->myDoc->properties = XML_DOC_HTML;
-+ ctxt->myDoc->parseFlags = ctxt->options;
- #else
- xmlGenericError(xmlGenericErrorContext,
- "libxml2 built without HTML support\n");
diff --git a/debian/patches/0013-Clear-up-a-potential-NULL-dereference.patch b/debian/patches/0013-Clear-up-a-potential-NULL-dereference.patch
deleted file mode 100644
index a18dfaf..0000000
--- a/debian/patches/0013-Clear-up-a-potential-NULL-dereference.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Sat, 3 Aug 2013 22:25:13 +0800
-Subject: Clear up a potential NULL dereference
-
-https://bugzilla.gnome.org/show_bug.cgi?id=705399
-
-if ctxt->node_seq.buffer is null then ctxt->node_seq.maximum ought
-to be zero but it's better to clarify the check in the code directly.
----
- parserInternals.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/parserInternals.c b/parserInternals.c
-index f8a7041..98a5836 100644
---- a/parserInternals.c
-+++ b/parserInternals.c
-@@ -1990,7 +1990,8 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
-
- /* Otherwise, we need to add new node to buffer */
- else {
-- if (ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) {
-+ if ((ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) ||
-+ (ctxt->node_seq.buffer == NULL)) {
- xmlParserNodeInfo *tmp_buffer;
- unsigned int byte_size;
-
diff --git a/debian/patches/0013-Fix-a-self-assignment-issue-raised-by-clang.patch b/debian/patches/0013-Fix-a-self-assignment-issue-raised-by-clang.patch
new file mode 100644
index 0000000..5cc28b2
--- /dev/null
+++ b/debian/patches/0013-Fix-a-self-assignment-issue-raised-by-clang.patch
@@ -0,0 +1,40 @@
+From: Scott Graham <scottmg@chromium.org>
+Date: Tue, 30 Jun 2015 10:47:16 +0800
+Subject: Fix a self assignment issue raised by clang
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=751679
+
+Also added a few newline cleanups
+---
+ xmlschemas.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/xmlschemas.c b/xmlschemas.c
+index 0657b66..d47512f 100644
+--- a/xmlschemas.c
++++ b/xmlschemas.c
+@@ -24186,6 +24186,7 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt,
+ else
+ goto pattern_and_enum;
+ }
++
+ /*
+ * Whitespace handling is only of importance for string-based
+ * types.
+@@ -24196,14 +24197,13 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt,
+ ws = xmlSchemaGetWhiteSpaceFacetValue(type);
+ } else
+ ws = XML_SCHEMA_WHITESPACE_COLLAPSE;
++
+ /*
+ * If the value was not computed (for string or
+ * anySimpleType based types), then use the provided
+ * type.
+ */
+- if (val == NULL)
+- valType = valType;
+- else
++ if (val != NULL)
+ valType = xmlSchemaGetValType(val);
+
+ ret = 0;
diff --git a/debian/patches/0014-Fix-XPath-optimization-with-predicates.patch b/debian/patches/0014-Fix-XPath-optimization-with-predicates.patch
deleted file mode 100644
index f24424a..0000000
--- a/debian/patches/0014-Fix-XPath-optimization-with-predicates.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From: Nick Wellnhofer <wellnhofer@aevum.de>
-Date: Sun, 4 Aug 2013 22:15:11 +0000
-Subject: Fix XPath '//' optimization with predicates
-
-My attempt to optimize XPath expressions containing '//' caused a
-regression reported in bug #695699. This commit disables the
-optimization for expressions of the form '//foo[predicate]'.
----
- xpath.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/xpath.c b/xpath.c
-index 97410e7..a676989 100644
---- a/xpath.c
-+++ b/xpath.c
-@@ -14719,8 +14719,9 @@ xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)
- * internal representation.
- */
-
-- if ((op->ch1 != -1) &&
-- (op->op == XPATH_OP_COLLECT /* 11 */))
-+ if ((op->op == XPATH_OP_COLLECT /* 11 */) &&
-+ (op->ch1 != -1) &&
-+ (op->ch2 == -1 /* no predicate */))
- {
- xmlXPathStepOpPtr prevop = &comp->steps[op->ch1];
-
diff --git a/debian/patches/0014-Fix-previous-change-to-node-sort-order.patch b/debian/patches/0014-Fix-previous-change-to-node-sort-order.patch
new file mode 100644
index 0000000..4ff344b
--- /dev/null
+++ b/debian/patches/0014-Fix-previous-change-to-node-sort-order.patch
@@ -0,0 +1,33 @@
+From: Nick Wellnhofer <wellnhofer@aevum.de>
+Date: Sat, 11 Jul 2015 14:27:34 +0200
+Subject: Fix previous change to node sort order
+
+Commit ba58f23 broke comparison of nodes from different documents.
+Thanks to Olli Pottonen for the report.
+---
+ xpath.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/xpath.c b/xpath.c
+index 95559b3..e60f4e5 100644
+--- a/xpath.c
++++ b/xpath.c
+@@ -361,14 +361,14 @@ turtle_comparison:
+ /*
+ * compute depth to root
+ */
+- for (depth2 = 0, cur = node2; cur != NULL; cur = cur->parent) {
+- if (cur == node1)
++ for (depth2 = 0, cur = node2; cur->parent != NULL; cur = cur->parent) {
++ if (cur->parent == node1)
+ return(1);
+ depth2++;
+ }
+ root = cur;
+- for (depth1 = 0, cur = node1; cur != NULL; cur = cur->parent) {
+- if (cur == node2)
++ for (depth1 = 0, cur = node1; cur->parent != NULL; cur = cur->parent) {
++ if (cur->parent == node2)
+ return(-1);
+ depth1++;
+ }
diff --git a/debian/patches/0015-Fix-the-spurious-ID-already-defined-error.patch b/debian/patches/0015-Fix-the-spurious-ID-already-defined-error.patch
new file mode 100644
index 0000000..61b7dfa
--- /dev/null
+++ b/debian/patches/0015-Fix-the-spurious-ID-already-defined-error.patch
@@ -0,0 +1,84 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 10 Sep 2015 19:41:41 +0800
+Subject: Fix the spurious ID already defined error
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=737840
+the fix for 724903 introduced a regression on external entities carrying
+IDs, revert that patch in part and add a specific test to avoid readding it
+---
+ result/valid/737840.xml | 10 ++++++++++
+ result/valid/737840.xml.err | 0
+ result/valid/737840.xml.err.rdr | 0
+ test/valid/737840.xml | 10 ++++++++++
+ test/valid/dtds/737840.ent | 1 +
+ valid.c | 6 ++++--
+ 6 files changed, 25 insertions(+), 2 deletions(-)
+ create mode 100644 result/valid/737840.xml
+ create mode 100644 result/valid/737840.xml.err
+ create mode 100644 result/valid/737840.xml.err.rdr
+ create mode 100644 test/valid/737840.xml
+ create mode 100644 test/valid/dtds/737840.ent
+
+diff --git a/result/valid/737840.xml b/result/valid/737840.xml
+new file mode 100644
+index 0000000..433c6d6
+--- /dev/null
++++ b/result/valid/737840.xml
+@@ -0,0 +1,10 @@
++<?xml version="1.0"?>
++<!DOCTYPE root [
++<!ELEMENT root (elem)>
++<!ELEMENT elem (#PCDATA)>
++<!ATTLIST elem id ID #IMPLIED>
++<!ENTITY target SYSTEM "dtds/737840.ent">
++]>
++<root>
++ &target;
++</root>
+diff --git a/result/valid/737840.xml.err b/result/valid/737840.xml.err
+new file mode 100644
+index 0000000..e69de29
+diff --git a/result/valid/737840.xml.err.rdr b/result/valid/737840.xml.err.rdr
+new file mode 100644
+index 0000000..e69de29
+diff --git a/test/valid/737840.xml b/test/valid/737840.xml
+new file mode 100644
+index 0000000..2d27b73
+--- /dev/null
++++ b/test/valid/737840.xml
+@@ -0,0 +1,10 @@
++<!DOCTYPE root [
++<!ELEMENT root (elem)>
++<!ELEMENT elem (#PCDATA)>
++<!ATTLIST elem id ID #IMPLIED>
++<!ENTITY target SYSTEM "dtds/737840.ent">
++]>
++
++<root>
++ &target;
++</root>
+diff --git a/test/valid/dtds/737840.ent b/test/valid/dtds/737840.ent
+new file mode 100644
+index 0000000..e972132
+--- /dev/null
++++ b/test/valid/dtds/737840.ent
+@@ -0,0 +1 @@
++<elem id="id0"/>
+\ No newline at end of file
+diff --git a/valid.c b/valid.c
+index 409aa81..45a3f70 100644
+--- a/valid.c
++++ b/valid.c
+@@ -2634,8 +2634,10 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
+ /*
+ * The id is already defined in this DTD.
+ */
+- xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
+- "ID %s already defined\n", value, NULL, NULL);
++ if (ctxt != NULL) {
++ xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
++ "ID %s already defined\n", value, NULL, NULL);
++ }
+ #endif /* LIBXML_VALID_ENABLED */
+ xmlFreeID(ret);
+ return(NULL);
diff --git a/debian/patches/0015-xmllint-pretty-crashed-without-following-numeric-arg.patch b/debian/patches/0015-xmllint-pretty-crashed-without-following-numeric-arg.patch
deleted file mode 100644
index b910c3a..0000000
--- a/debian/patches/0015-xmllint-pretty-crashed-without-following-numeric-arg.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From: Tim Galeckas <tim@galeckas.com>
-Date: Thu, 29 Aug 2013 16:44:33 +0800
-Subject: xmllint --pretty crashed without following numeric argument
-
-https://bugzilla.gnome.org/show_bug.cgi?id=674789
-
-We need to check for NULL argument before calling atoi()
----
- xmllint.c | 12 +++++++-----
- 1 file changed, 7 insertions(+), 5 deletions(-)
-
-diff --git a/xmllint.c b/xmllint.c
-index 92e6b03..d69722c 100644
---- a/xmllint.c
-+++ b/xmllint.c
-@@ -3388,11 +3388,13 @@ main(int argc, char **argv) {
- (!strcmp(argv[i], "--pretty"))) {
- i++;
- #ifdef LIBXML_OUTPUT_ENABLED
-- format = atoi(argv[i]);
-- if (format == 1) {
-- noblanks++;
-- xmlKeepBlanksDefault(0);
-- }
-+ if (argv[i] != NULL) {
-+ format = atoi(argv[i]);
-+ if (format == 1) {
-+ noblanks++;
-+ xmlKeepBlanksDefault(0);
-+ }
-+ }
- #endif /* LIBXML_OUTPUT_ENABLED */
- }
- #ifdef LIBXML_READER_ENABLED
diff --git a/debian/patches/0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch b/debian/patches/0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch
deleted file mode 100644
index fa8a176..0000000
--- a/debian/patches/0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From: Gaurav <g.gupta@samsung.com>
-Date: Wed, 11 Sep 2013 14:59:06 +0800
-Subject: Fix potential NULL pointer dereferences in regexp code
-
-https://bugzilla.gnome.org/show_bug.cgi?id=707749
-
-Fix 3 cases where we might dereference NULL
----
- xmlregexp.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/xmlregexp.c b/xmlregexp.c
-index 1f9911c..8e63d74 100644
---- a/xmlregexp.c
-+++ b/xmlregexp.c
-@@ -3162,8 +3162,10 @@ xmlFARegExecRollBack(xmlRegExecCtxtPtr exec) {
- exec->status = -6;
- return;
- }
-- memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts,
-+ if (exec->counts) {
-+ memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts,
- exec->comp->nbCounters * sizeof(int));
-+ }
- }
-
- #ifdef DEBUG_REGEXP_EXEC
-@@ -4091,7 +4093,7 @@ rollback:
- */
- exec->determinist = 0;
- xmlFARegExecRollBack(exec);
-- if (exec->status == 0) {
-+ if ((exec->inputStack != NULL ) && (exec->status == 0)) {
- value = exec->inputStack[exec->index].value;
- data = exec->inputStack[exec->index].data;
- #ifdef DEBUG_PUSH
-@@ -4306,7 +4308,7 @@ xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err,
- (*nbval)++;
- }
- } else {
-- if ((exec->comp->states[trans->to] != NULL) &&
-+ if ((exec->comp != NULL) && (exec->comp->states[trans->to] != NULL) &&
- (exec->comp->states[trans->to]->type !=
- XML_REGEXP_SINK_STATE)) {
- if (atom->neg)
diff --git a/debian/patches/0017-Fix-a-potential-NULL-dereference-in-tree-code.patch b/debian/patches/0017-Fix-a-potential-NULL-dereference-in-tree-code.patch
deleted file mode 100644
index 2c55813..0000000
--- a/debian/patches/0017-Fix-a-potential-NULL-dereference-in-tree-code.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Wed, 11 Sep 2013 15:11:27 +0800
-Subject: Fix a potential NULL dereference in tree code
-
-https://bugzilla.gnome.org/show_bug.cgi?id=707750
-
-Also reported by Gaurav, simple fix to check the pointer before
-dereference
----
- tree.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/tree.c b/tree.c
-index 7e5af26..efc3ca2 100644
---- a/tree.c
-+++ b/tree.c
-@@ -9780,7 +9780,8 @@ leave_node:
- if (clone->parent != NULL)
- clone->parent->last = clone;
- clone = clone->parent;
-- parentClone = clone->parent;
-+ if (clone != NULL)
-+ parentClone = clone->parent;
- /*
- * Process parent --> next;
- */
diff --git a/debian/patches/0018-Fix-pointer-dereferenced-before-null-check.patch b/debian/patches/0018-Fix-pointer-dereferenced-before-null-check.patch
deleted file mode 100644
index 3ae1c59..0000000
--- a/debian/patches/0018-Fix-pointer-dereferenced-before-null-check.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: Gaurav <g.gupta@samsung.com>
-Date: Mon, 30 Sep 2013 10:43:47 +0800
-Subject: Fix pointer dereferenced before null check
-
-for https://bugzilla.gnome.org/show_bug.cgi?id=708364
-
-xmlValidateElementContent is a private function but should still
-check the ctxt argument before dereferencing
----
- valid.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/valid.c b/valid.c
-index 6e53a76..e0832e7 100644
---- a/valid.c
-+++ b/valid.c
-@@ -5236,7 +5236,7 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
- xmlElementContentPtr cont;
- const xmlChar *name;
-
-- if ((elemDecl == NULL) || (parent == NULL))
-+ if ((elemDecl == NULL) || (parent == NULL) || (ctxt == NULL))
- return(-1);
- cont = elemDecl->content;
- name = elemDecl->name;
diff --git a/debian/patches/0019-Fix-a-bug-loading-some-compressed-files.patch b/debian/patches/0019-Fix-a-bug-loading-some-compressed-files.patch
deleted file mode 100644
index 48b4fa4..0000000
--- a/debian/patches/0019-Fix-a-bug-loading-some-compressed-files.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From: Mike Alexander <mta@umich.edu>
-Date: Thu, 28 Nov 2013 23:21:23 +0800
-Subject: Fix a bug loading some compressed files
-
-For https://bugzilla.gnome.org/show_bug.cgi?id=712528
-Related to https://bugzilla.redhat.com/show_bug.cgi?id=877567
-
-There is a bug in xzlib.c which causes certain compressed XML files to fail to
-load correctly. The code in xz_decomp which attempts to verify the checksum
-and length of the expanded data fails if the checksum or length at the end of
-the file crosses a 1024 byte boundary. It calls gz_next4 to get those two
-values. This function uses the stream state in state->zstrm, but calls
-xz_avail which uses the state->strm stream info. This causes gz_next4 to
-signal a premature EOF if the data it is fetching crosses a 1024 byte boundary.
----
- xzlib.c | 26 ++++++++++++++++++++++----
- 1 file changed, 22 insertions(+), 4 deletions(-)
-
-diff --git a/xzlib.c b/xzlib.c
-index 928bd17..cd045fa 100644
---- a/xzlib.c
-+++ b/xzlib.c
-@@ -245,6 +245,20 @@ xz_avail(xz_statep state)
- return 0;
- }
-
-+#ifdef HAVE_ZLIB_H
-+static int
-+xz_avail_zstrm(xz_statep state)
-+{
-+ int ret;
-+ state->strm.avail_in = state->zstrm.avail_in;
-+ state->strm.next_in = state->zstrm.next_in;
-+ ret = xz_avail(state);
-+ state->zstrm.avail_in = (uInt) state->strm.avail_in;
-+ state->zstrm.next_in = (Bytef *) state->strm.next_in;
-+ return ret;
-+}
-+#endif
-+
- static int
- is_format_xz(xz_statep state)
- {
-@@ -314,6 +328,10 @@ is_format_lzma(xz_statep state)
- #define NEXT() ((strm->avail_in == 0 && xz_avail(state) == -1) ? -1 : \
- (strm->avail_in == 0 ? -1 : \
- (strm->avail_in--, *(strm->next_in)++)))
-+/* Same thing, but from zstrm */
-+#define NEXTZ() ((strm->avail_in == 0 && xz_avail_zstrm(state) == -1) ? -1 : \
-+ (strm->avail_in == 0 ? -1 : \
-+ (strm->avail_in--, *(strm->next_in)++)))
-
- /* Get a four-byte little-endian integer and return 0 on success and the value
- in *ret. Otherwise -1 is returned and *ret is not modified. */
-@@ -324,10 +342,10 @@ gz_next4(xz_statep state, unsigned long *ret)
- unsigned long val;
- z_streamp strm = &(state->zstrm);
-
-- val = NEXT();
-- val += (unsigned) NEXT() << 8;
-- val += (unsigned long) NEXT() << 16;
-- ch = NEXT();
-+ val = NEXTZ();
-+ val += (unsigned) NEXTZ() << 8;
-+ val += (unsigned long) NEXTZ() << 16;
-+ ch = NEXTZ();
- if (ch == -1)
- return -1;
- val += (unsigned long) ch << 24;
diff --git a/debian/patches/0020-Avoid-a-possibility-of-dangling-encoding-handler.patch b/debian/patches/0020-Avoid-a-possibility-of-dangling-encoding-handler.patch
deleted file mode 100644
index ab0bde8..0000000
--- a/debian/patches/0020-Avoid-a-possibility-of-dangling-encoding-handler.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From: Gaurav <g.gupta@samsung.com>
-Date: Fri, 29 Nov 2013 23:10:50 +0800
-Subject: Avoid a possibility of dangling encoding handler
-
-For https://bugzilla.gnome.org/show_bug.cgi?id=711149
-
-In Function:
-int xmlCharEncCloseFunc(xmlCharEncodingHandler *handler)
-
-If the freed handler is any one of handlers[i] list, then it will make that
-hanldlers[i] as dangling. This may lead to crash issues at places where
-handlers is read.
----
- encoding.c | 16 ++++++++++++++--
- 1 file changed, 14 insertions(+), 2 deletions(-)
-
-diff --git a/encoding.c b/encoding.c
-index 7330e90..d4fc45f 100644
---- a/encoding.c
-+++ b/encoding.c
-@@ -2851,14 +2851,25 @@ int
- xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
- int ret = 0;
- int tofree = 0;
-+ int i, handler_in_list = 0;
-+
- if (handler == NULL) return(-1);
- if (handler->name == NULL) return(-1);
-+ if (handlers != NULL) {
-+ for (i = 0;i < nbCharEncodingHandler; i++) {
-+ if (handler == handlers[i]) {
-+ handler_in_list = 1;
-+ break;
-+ }
-+ }
-+ }
- #ifdef LIBXML_ICONV_ENABLED
- /*
- * Iconv handlers can be used only once, free the whole block.
- * and the associated icon resources.
- */
-- if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
-+ if ((handler_in_list == 0) &&
-+ ((handler->iconv_out != NULL) || (handler->iconv_in != NULL))) {
- tofree = 1;
- if (handler->iconv_out != NULL) {
- if (iconv_close(handler->iconv_out))
-@@ -2873,7 +2884,8 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
- }
- #endif /* LIBXML_ICONV_ENABLED */
- #ifdef LIBXML_ICU_ENABLED
-- if ((handler->uconv_out != NULL) || (handler->uconv_in != NULL)) {
-+ if ((handler_in_list == 0) &&
-+ ((handler->uconv_out != NULL) || (handler->uconv_in != NULL))) {
- tofree = 1;
- if (handler->uconv_out != NULL) {
- closeIcuConverter(handler->uconv_out);
diff --git a/debian/patches/0021-Fix-a-couple-of-missing-NULL-checks.patch b/debian/patches/0021-Fix-a-couple-of-missing-NULL-checks.patch
deleted file mode 100644
index 6771dbb..0000000
--- a/debian/patches/0021-Fix-a-couple-of-missing-NULL-checks.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From: Gaurav <g.gupta@samsung.com>
-Date: Fri, 29 Nov 2013 23:28:21 +0800
-Subject: Fix a couple of missing NULL checks
-
-For https://bugzilla.gnome.org/show_bug.cgi?id=708681
----
- tree.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/tree.c b/tree.c
-index efc3ca2..43c3c57 100644
---- a/tree.c
-+++ b/tree.c
-@@ -4294,6 +4294,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
- }
- if (doc->intSubset == NULL) {
- q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
-+ if (q == NULL) return(NULL);
- q->doc = doc;
- q->parent = parent;
- doc->intSubset = (xmlDtdPtr) q;
-@@ -4305,6 +4306,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
- } else
- #endif /* LIBXML_TREE_ENABLED */
- q = xmlStaticCopyNode(node, doc, parent, 1);
-+ if (q == NULL) return(NULL);
- if (ret == NULL) {
- q->prev = NULL;
- ret = p = q;
diff --git a/debian/patches/0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch b/debian/patches/0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch
deleted file mode 100644
index 7820411..0000000
--- a/debian/patches/0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Mon, 9 Dec 2013 15:23:40 +0800
-Subject: adding init calls to xml and html Read parsing entry points
-
-As pointed out by "Tassyns, Bram <BramT@enfocus.com>" on the list
-some call had it other didn't, clean it up and add to all missing
-ones
----
- HTMLparser.c | 6 ++++++
- parser.c | 10 ++++++++++
- 2 files changed, 16 insertions(+)
-
-diff --git a/HTMLparser.c b/HTMLparser.c
-index dd0c1ea..44c1a3c 100644
---- a/HTMLparser.c
-+++ b/HTMLparser.c
-@@ -6808,6 +6808,7 @@ htmlReadFd(int fd, const char *URL, const char *encoding, int options)
-
- if (fd < 0)
- return (NULL);
-+ xmlInitParser();
-
- xmlInitParser();
- input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
-@@ -6898,6 +6899,7 @@ htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur,
- return (NULL);
- if (ctxt == NULL)
- return (NULL);
-+ xmlInitParser();
-
- htmlCtxtReset(ctxt);
-
-@@ -6931,6 +6933,7 @@ htmlCtxtReadFile(htmlParserCtxtPtr ctxt, const char *filename,
- return (NULL);
- if (ctxt == NULL)
- return (NULL);
-+ xmlInitParser();
-
- htmlCtxtReset(ctxt);
-
-@@ -6967,6 +6970,7 @@ htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size,
- return (NULL);
- if (buffer == NULL)
- return (NULL);
-+ xmlInitParser();
-
- htmlCtxtReset(ctxt);
-
-@@ -7009,6 +7013,7 @@ htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd,
- return (NULL);
- if (ctxt == NULL)
- return (NULL);
-+ xmlInitParser();
-
- htmlCtxtReset(ctxt);
-
-@@ -7053,6 +7058,7 @@ htmlCtxtReadIO(htmlParserCtxtPtr ctxt, xmlInputReadCallback ioread,
- return (NULL);
- if (ctxt == NULL)
- return (NULL);
-+ xmlInitParser();
-
- htmlCtxtReset(ctxt);
-
-diff --git a/parser.c b/parser.c
-index dd00399..ad400f4 100644
---- a/parser.c
-+++ b/parser.c
-@@ -15217,6 +15217,7 @@ xmlReadDoc(const xmlChar * cur, const char *URL, const char *encoding, int optio
-
- if (cur == NULL)
- return (NULL);
-+ xmlInitParser();
-
- ctxt = xmlCreateDocParserCtxt(cur);
- if (ctxt == NULL)
-@@ -15239,6 +15240,7 @@ xmlReadFile(const char *filename, const char *encoding, int options)
- {
- xmlParserCtxtPtr ctxt;
-
-+ xmlInitParser();
- ctxt = xmlCreateURLParserCtxt(filename, options);
- if (ctxt == NULL)
- return (NULL);
-@@ -15262,6 +15264,7 @@ xmlReadMemory(const char *buffer, int size, const char *URL, const char *encodin
- {
- xmlParserCtxtPtr ctxt;
-
-+ xmlInitParser();
- ctxt = xmlCreateMemoryParserCtxt(buffer, size);
- if (ctxt == NULL)
- return (NULL);
-@@ -15290,6 +15293,7 @@ xmlReadFd(int fd, const char *URL, const char *encoding, int options)
-
- if (fd < 0)
- return (NULL);
-+ xmlInitParser();
-
- input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
- if (input == NULL)
-@@ -15333,6 +15337,7 @@ xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
-
- if (ioread == NULL)
- return (NULL);
-+ xmlInitParser();
-
- input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
- XML_CHAR_ENCODING_NONE);
-@@ -15379,6 +15384,7 @@ xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur,
- return (NULL);
- if (ctxt == NULL)
- return (NULL);
-+ xmlInitParser();
-
- xmlCtxtReset(ctxt);
-
-@@ -15412,6 +15418,7 @@ xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename,
- return (NULL);
- if (ctxt == NULL)
- return (NULL);
-+ xmlInitParser();
-
- xmlCtxtReset(ctxt);
-
-@@ -15448,6 +15455,7 @@ xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size,
- return (NULL);
- if (buffer == NULL)
- return (NULL);
-+ xmlInitParser();
-
- xmlCtxtReset(ctxt);
-
-@@ -15492,6 +15500,7 @@ xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd,
- return (NULL);
- if (ctxt == NULL)
- return (NULL);
-+ xmlInitParser();
-
- xmlCtxtReset(ctxt);
-
-@@ -15537,6 +15546,7 @@ xmlCtxtReadIO(xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread,
- return (NULL);
- if (ctxt == NULL)
- return (NULL);
-+ xmlInitParser();
-
- xmlCtxtReset(ctxt);
-
diff --git a/debian/patches/0023-Handling-of-XPath-function-arguments-in-error-case.patch b/debian/patches/0023-Handling-of-XPath-function-arguments-in-error-case.patch
deleted file mode 100644
index cc18db7..0000000
--- a/debian/patches/0023-Handling-of-XPath-function-arguments-in-error-case.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From: Nick Wellnhofer <wellnhofer@aevum.de>
-Date: Fri, 20 Dec 2013 00:01:53 +0100
-Subject: Handling of XPath function arguments in error case
-
-The XPath engine tries to guarantee that every XPath function can pop
-'nargs' non-NULL values off the stack. libxslt, for example, relies on
-this assumption. But the check isn't thorough enough if there are errors
-during the evaluation of arguments. This can lead to segfaults:
-
-https://mail.gnome.org/archives/xslt/2013-December/msg00005.html
-
-This commit makes the handling of function arguments more robust.
-
-* Bail out early when evaluation of XPath function arguments fails.
-* Make sure that there are 'nargs' arguments in the current call frame.
----
- xpath.c | 9 +++++++--
- 1 file changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/xpath.c b/xpath.c
-index a676989..a75df9b 100644
---- a/xpath.c
-+++ b/xpath.c
-@@ -13512,10 +13512,15 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
- int frame;
-
- frame = xmlXPathSetFrame(ctxt);
-- if (op->ch1 != -1)
-+ if (op->ch1 != -1) {
- total +=
- xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
-- if (ctxt->valueNr < op->value) {
-+ if (ctxt->error != XPATH_EXPRESSION_OK) {
-+ xmlXPathPopFrame(ctxt, frame);
-+ return (total);
-+ }
-+ }
-+ if (ctxt->valueNr < ctxt->valueFrame + op->value) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompOpEval: parameter error\n");
- ctxt->error = XPATH_INVALID_OPERAND;
diff --git a/debian/patches/0024-Missing-initialization-for-the-catalog-module.patch b/debian/patches/0024-Missing-initialization-for-the-catalog-module.patch
deleted file mode 100644
index c5a5d16..0000000
--- a/debian/patches/0024-Missing-initialization-for-the-catalog-module.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Sun, 26 Jan 2014 15:02:25 +0100
-Subject: Missing initialization for the catalog module
-
----
- parser.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/parser.c b/parser.c
-index ad400f4..7381a78 100644
---- a/parser.c
-+++ b/parser.c
-@@ -14720,6 +14720,9 @@ xmlInitParser(void) {
- #ifdef LIBXML_XPATH_ENABLED
- xmlXPathInit();
- #endif
-+#ifdef LIBXML_CATALOG_ENABLED
-+ xmlInitializeCatalog();
-+#endif
- xmlParserInitialized = 1;
- #ifdef LIBXML_THREAD_ENABLED
- }
diff --git a/debian/patches/0025-Fix-an-fd-leak-in-an-error-case.patch b/debian/patches/0025-Fix-an-fd-leak-in-an-error-case.patch
deleted file mode 100644
index edf1752..0000000
--- a/debian/patches/0025-Fix-an-fd-leak-in-an-error-case.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Thu, 6 Feb 2014 10:38:00 +0100
-Subject: Fix an fd leak in an error case
-
----
- catalog.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/catalog.c b/catalog.c
-index 8e34cd2..56991da 100644
---- a/catalog.c
-+++ b/catalog.c
-@@ -994,6 +994,11 @@ xmlLoadFileContent(const char *filename)
- content = (xmlChar*)xmlMallocAtomic(size + 10);
- if (content == NULL) {
- xmlCatalogErrMemory("allocating catalog data");
-+#ifdef HAVE_STAT
-+ close(fd);
-+#else
-+ fclose(fd);
-+#endif
- return (NULL);
- }
- #ifdef HAVE_STAT
diff --git a/debian/patches/0026-fixing-a-ptotential-uninitialized-access.patch b/debian/patches/0026-fixing-a-ptotential-uninitialized-access.patch
deleted file mode 100644
index 65eae92..0000000
--- a/debian/patches/0026-fixing-a-ptotential-uninitialized-access.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Thu, 6 Feb 2014 10:47:20 +0100
-Subject: fixing a ptotential uninitialized access
-
----
- valid.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/valid.c b/valid.c
-index e0832e7..114bb72 100644
---- a/valid.c
-+++ b/valid.c
-@@ -6948,7 +6948,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names,
- int max) {
- xmlValidCtxt vctxt;
- int nb_valid_elements = 0;
-- const xmlChar *elements[256];
-+ const xmlChar *elements[256]={0};
- int nb_elements = 0, i;
- const xmlChar *name;
-
diff --git a/debian/patches/0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch b/debian/patches/0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch
deleted file mode 100644
index 22d206a..0000000
--- a/debian/patches/0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Sat, 8 Feb 2014 02:22:35 +0800
-Subject: Fix xmlTextWriterWriteElement when a null content is given
-
----
- xmlwriter.c | 10 ++++++----
- 1 file changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/xmlwriter.c b/xmlwriter.c
-index d3f29f8..27209b9 100644
---- a/xmlwriter.c
-+++ b/xmlwriter.c
-@@ -2238,10 +2238,12 @@ xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name,
- if (count == -1)
- return -1;
- sum += count;
-- count = xmlTextWriterWriteString(writer, content);
-- if (count == -1)
-- return -1;
-- sum += count;
-+ if (content != NULL) {
-+ count = xmlTextWriterWriteString(writer, content);
-+ if (count == -1)
-+ return -1;
-+ sum += count;
-+ }
- count = xmlTextWriterEndElement(writer);
- if (count == -1)
- return -1;
diff --git a/debian/patches/0028-Avoid-a-possible-NULL-pointer-dereference.patch b/debian/patches/0028-Avoid-a-possible-NULL-pointer-dereference.patch
deleted file mode 100644
index 219d13a..0000000
--- a/debian/patches/0028-Avoid-a-possible-NULL-pointer-dereference.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From: Gaurav <g.gupta@samsung.com>
-Date: Tue, 18 Feb 2014 11:47:43 +0800
-Subject: Avoid a possible NULL pointer dereference
-
-For https://bugzilla.gnome.org/show_bug.cgi?id=708355
----
- xmlmodule.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/xmlmodule.c b/xmlmodule.c
-index 7fe5bc2..50ed666 100644
---- a/xmlmodule.c
-+++ b/xmlmodule.c
-@@ -115,7 +115,7 @@ xmlModuleSymbol(xmlModulePtr module, const char *name, void **symbol)
- {
- int rc = -1;
-
-- if ((NULL == module) || (symbol == NULL)) {
-+ if ((NULL == module) || (symbol == NULL) || (name == NULL)) {
- __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
- XML_MODULE_OPEN, XML_ERR_FATAL, NULL, 0, 0,
- NULL, NULL, 0, 0, "null parameter\n");
diff --git a/debian/patches/0029-Do-not-fetch-external-parameter-entities.patch b/debian/patches/0029-Do-not-fetch-external-parameter-entities.patch
deleted file mode 100644
index 06ec27c..0000000
--- a/debian/patches/0029-Do-not-fetch-external-parameter-entities.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Tue, 22 Apr 2014 15:30:56 +0800
-Subject: Do not fetch external parameter entities
-
-Unless explicitely asked for when validating or replacing entities
-with their value. Problem pointed out by Daniel Berrange <berrange@redhat.com>
----
- parser.c | 14 ++++++++++++++
- 1 file changed, 14 insertions(+)
-
-diff --git a/parser.c b/parser.c
-index 7381a78..8aad7b4 100644
---- a/parser.c
-+++ b/parser.c
-@@ -2595,6 +2595,20 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
- xmlCharEncoding enc;
-
- /*
-+ * Note: external parsed entities will not be loaded, it is
-+ * not required for a non-validating parser, unless the
-+ * option of validating, or substituting entities were
-+ * given. Doing so is far more secure as the parser will
-+ * only process data coming from the document entity by
-+ * default.
-+ */
-+ if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
-+ ((ctxt->options & XML_PARSE_NOENT) == 0) &&
-+ ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
-+ (ctxt->validate == 0))
-+ return;
-+
-+ /*
- * handle the extra spaces added before and after
- * c.f. http://www.w3.org/TR/REC-xml#as-PE
- * this is done independently.
diff --git a/debian/patches/0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch b/debian/patches/0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch
deleted file mode 100644
index 8a84731..0000000
--- a/debian/patches/0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From: Gaurav <g.gupta@samsung.com>
-Date: Fri, 9 May 2014 17:00:08 +0800
-Subject: Avoid Possible null pointer dereference in memory debug mode
-
-Fix a use before check on pointer
-For https://bugzilla.gnome.org/show_bug.cgi?id=729849
----
- xmlmemory.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/xmlmemory.c b/xmlmemory.c
-index 25d9318..37dcf3b 100644
---- a/xmlmemory.c
-+++ b/xmlmemory.c
-@@ -583,13 +583,15 @@ xmlMemBlocks(void) {
- static void
- xmlMemContentShow(FILE *fp, MEMHDR *p)
- {
-- int i,j,k,len = p->mh_size;
-- const char *buf = (const char *) HDR_2_CLIENT(p);
-+ int i,j,k,len;
-+ const char *buf;
-
- if (p == NULL) {
- fprintf(fp, " NULL");
- return;
- }
-+ len = p->mh_size;
-+ buf = (const char *) HDR_2_CLIENT(p);
-
- for (i = 0;i < len;i++) {
- if (buf[i] == 0) break;
diff --git a/debian/patches/0031-xmllint-was-not-parsing-the-c14n11-flag.patch b/debian/patches/0031-xmllint-was-not-parsing-the-c14n11-flag.patch
deleted file mode 100644
index 7b24f6b..0000000
--- a/debian/patches/0031-xmllint-was-not-parsing-the-c14n11-flag.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From: =?UTF-8?q?S=C3=A9rgio=20Batista?= <mail@se.rg.io>
-Date: Mon, 9 Jun 2014 22:10:15 +0800
-Subject: xmllint was not parsing the --c14n11 flag
-
-Cut and paste error, using the wrong variable
----
- xmllint.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/xmllint.c b/xmllint.c
-index d69722c..4a5d043 100644
---- a/xmllint.c
-+++ b/xmllint.c
-@@ -2573,7 +2573,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
- fprintf(stderr, "Failed to canonicalize\n");
- progresult = XMLLINT_ERR_OUT;
- }
-- } else if (canonical) {
-+ } else if (canonical_11) {
- xmlChar *result = NULL;
- int size;
-
diff --git a/debian/patches/0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch b/debian/patches/0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch
deleted file mode 100644
index d9fc108..0000000
--- a/debian/patches/0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Wed, 11 Jun 2014 16:54:32 +0800
-Subject: Fix regressions introduced by CVE-2014-0191 patch
-
-A number of issues have been raised after the fix, and this patch
-tries to correct all of them, though most were related to
-postvalidation.
-https://bugzilla.gnome.org/show_bug.cgi?id=730290
-and other reports on list, off-list and on Red Hat bugzilla
----
- parser.c | 13 +++++++++++--
- 1 file changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/parser.c b/parser.c
-index 8aad7b4..ea0ea65 100644
---- a/parser.c
-+++ b/parser.c
-@@ -2595,8 +2595,8 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
- xmlCharEncoding enc;
-
- /*
-- * Note: external parsed entities will not be loaded, it is
-- * not required for a non-validating parser, unless the
-+ * Note: external parameter entities will not be loaded, it
-+ * is not required for a non-validating parser, unless the
- * option of validating, or substituting entities were
- * given. Doing so is far more secure as the parser will
- * only process data coming from the document entity by
-@@ -2605,6 +2605,9 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
- if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
- ((ctxt->options & XML_PARSE_NOENT) == 0) &&
- ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
-+ ((ctxt->options & XML_PARSE_DTDLOAD) == 0) &&
-+ ((ctxt->options & XML_PARSE_DTDATTR) == 0) &&
-+ (ctxt->replaceEntities == 0) &&
- (ctxt->validate == 0))
- return;
-
-@@ -12609,6 +12612,9 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
- return(NULL);
- }
-
-+ /* We are loading a DTD */
-+ ctxt->options |= XML_PARSE_DTDLOAD;
-+
- /*
- * Set-up the SAX context
- */
-@@ -12736,6 +12742,9 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
- return(NULL);
- }
-
-+ /* We are loading a DTD */
-+ ctxt->options |= XML_PARSE_DTDLOAD;
-+
- /*
- * Set-up the SAX context
- */
diff --git a/debian/patches/series b/debian/patches/series
index ce6e665..6d8ee86 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,32 +1,15 @@
0001-modify-xml2-config-and-pkgconfig-behaviour.patch
0002-fix-python-multiarch-includes.patch
-0003-Fix-an-error-in-xmlCleanupParser.patch
-0004-Fix-missing-break-on-last-function-for-attributes.patch
-0005-xmllint-memory-should-fail-on-empty-files.patch
-0006-properly-quote-the-namespace-uris-written-out-during.patch
-0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch
-0008-missing-else-in-xlink.c.patch
-0009-Catch-malloc-error-and-exit-accordingly.patch
-0010-Fix-handling-of-mmap-errors.patch
-0011-Avoid-crash-if-allocation-fails.patch
-0012-Fix-a-possible-NULL-dereference.patch
-0013-Clear-up-a-potential-NULL-dereference.patch
-0014-Fix-XPath-optimization-with-predicates.patch
-0015-xmllint-pretty-crashed-without-following-numeric-arg.patch
-0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch
-0017-Fix-a-potential-NULL-dereference-in-tree-code.patch
-0018-Fix-pointer-dereferenced-before-null-check.patch
-0019-Fix-a-bug-loading-some-compressed-files.patch
-0020-Avoid-a-possibility-of-dangling-encoding-handler.patch
-0021-Fix-a-couple-of-missing-NULL-checks.patch
-0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch
-0023-Handling-of-XPath-function-arguments-in-error-case.patch
-0024-Missing-initialization-for-the-catalog-module.patch
-0025-Fix-an-fd-leak-in-an-error-case.patch
-0026-fixing-a-ptotential-uninitialized-access.patch
-0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch
-0028-Avoid-a-possible-NULL-pointer-dereference.patch
-0029-Do-not-fetch-external-parameter-entities.patch
-0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch
-0031-xmllint-was-not-parsing-the-c14n11-flag.patch
-0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch
+0003-Revert-Missing-initialization-for-the-catalog-module.patch
+0004-Fix-missing-entities-after-CVE-2014-3660-fix.patch
+0005-Account-for-ID-attributes-in-xmlSetTreeDoc.patch
+0006-Stop-parsing-on-entities-boundaries-errors.patch
+0007-Cleanup-conditional-section-error-handling.patch
+0008-Fix-order-of-root-nodes.patch
+0009-xmlMemUsed-is-not-thread-safe.patch
+0010-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
+0011-Do-not-process-encoding-values-if-the-declaration-if.patch
+0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch
+0013-Fix-a-self-assignment-issue-raised-by-clang.patch
+0014-Fix-previous-change-to-node-sort-order.patch
+0015-Fix-the-spurious-ID-already-defined-error.patch
diff --git a/debian/rules b/debian/rules
index 9acaf97..bd2dcba 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,7 +13,7 @@ DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
CC = $(DEB_HOST_GNU_TYPE)-gcc
-CFLAGS = `dpkg-buildflags --get CFLAGS` -Wall
+CFLAGS = `dpkg-buildflags --get CFLAGS` -Wall -O3
LDFLAGS = `dpkg-buildflags --get LDFLAGS` -Wl,--as-needed
CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
@@ -47,10 +47,9 @@ debian/autoreconf.after:
doconfigure-%: debian/autoreconf.after
dh_auto_configure --builddirectory=builddir/$* -- $(CONFIGURE_FLAGS)
-doconfigure-main: CONFIGURE_FLAGS += --without-python
+doconfigure-main: CONFIGURE_FLAGS += --without-python --with-icu
doconfigure-python%: CONFIGURE_FLAGS += --with-python=/usr/bin/$*
-#doconfigure-udeb: CONFIGURE_FLAGS += --without-history --with-minimum --with-tree --with-output
-doconfigure-udeb: CONFIGURE_FLAGS += --without-history --with-tree --with-output --without-python
+doconfigure-udeb: CONFIGURE_FLAGS += --without-history --with-tree --with-output --without-python --without-icu
# For dyson we need 32-bit library, but we don't have 32-bit liblzma
doconfigure-32: CONFIGURE_FLAGS += --without-python --libdir=/usr/lib32 --without-lzma
@@ -72,6 +71,8 @@ dobuild-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES="$(shell $(DEB_HOST_GNU_TYPE
PYTHON_LIBS="$(shell $(DEB_HOST_GNU_TYPE)-python-dbg-config --ldflags)" \
CFLAGS="$(CFLAGS) -Wall -g -O0" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS) \
-L$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)"
+
+#override_dh_auto_build: $(TARGETS:%=dobuild-%)
build-arch: $(TARGETS:%=dobuild-%)
build-indep:
build: build-arch build-indep
@@ -90,7 +91,6 @@ doinstall-32:
doinstall-main:
dh_auto_install --builddirectory=builddir/main
mv debian/tmp/usr/share/aclocal/libxml.m4 debian/tmp/usr/share/aclocal/libxml2.m4
-
# Properly install documentation in /usr/share/doc/libxml2-doc
install -d debian/tmp/usr/share/doc/libxml2-doc/examples
install -m 644 \
@@ -153,11 +153,12 @@ endif
override_dh_makeshlibs:
dh_makeshlibs -a $(if $(WITH_UDEB),--add-udeb=libxml2-udeb ) -- -c4
+override_dh_gencontrol:
+ dh_gencontrol -- -Vdep:libicudbg="`dpkg-query -f '$${Depends}' -W libicu-dev | sed 's/.*\(libicu[0-9]*\).*/\1/'`-dbg"
+
%:
ifeq ($(DEB_BUILD_PROFILE),stage1)
dh $@ --with autoreconf
else
- dh $@ --with autoreconf,python2
+ dh $@ --parallel --with autoreconf,python2
endif
-
-