From 972dcfcdbfe75dcfeb777150c136576cf1a71e99 Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Fri, 9 Oct 2015 22:59:03 +0200 Subject: initial commit for Enea Linux 5.0 arm Signed-off-by: Tudor Florea --- meta/recipes-core/libxml/libxml2.inc | 78 ++ ...19-Enforce-the-reader-to-run-in-constant-.patch | 181 +++++ .../72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch | 30 + meta/recipes-core/libxml/libxml2/ansidecl.patch | 25 + .../recipes-core/libxml/libxml2/libxml-64bit.patch | 22 + .../libxml/libxml2/libxml-m4-use-pkgconfig.patch | 204 +++++ .../libxml/libxml2/libxml2-CVE-2014-0191-fix.patch | 37 + .../libxml/libxml2/libxml2-CVE-2014-3660.patch | 147 ++++ .../libxml/libxml2/python-sitepackages-dir.patch | 21 + meta/recipes-core/libxml/libxml2/run-ptest | 3 + meta/recipes-core/libxml/libxml2/runtest.patch | 820 +++++++++++++++++++++ meta/recipes-core/libxml/libxml2_2.9.1.bb | 9 + 12 files changed, 1577 insertions(+) create mode 100644 meta/recipes-core/libxml/libxml2.inc create mode 100644 meta/recipes-core/libxml/libxml2/0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch create mode 100644 meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch create mode 100644 meta/recipes-core/libxml/libxml2/ansidecl.patch create mode 100644 meta/recipes-core/libxml/libxml2/libxml-64bit.patch create mode 100644 meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch create mode 100644 meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch create mode 100644 meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch create mode 100644 meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch create mode 100644 meta/recipes-core/libxml/libxml2/run-ptest create mode 100644 meta/recipes-core/libxml/libxml2/runtest.patch create mode 100644 meta/recipes-core/libxml/libxml2_2.9.1.bb (limited to 'meta/recipes-core/libxml') diff --git a/meta/recipes-core/libxml/libxml2.inc b/meta/recipes-core/libxml/libxml2.inc new file mode 100644 index 0000000000..840a8eb006 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2.inc @@ -0,0 +1,78 @@ +SUMMARY = "XML C Parser Library and Toolkit" +DESCRIPTION = "The XML Parser Library allows for manipulation of XML files. Libxml2 exports Push and Pull type parser interfaces for both XML and HTML. It can do DTD validation at parse time, on a parsed document instance or with an arbitrary DTD. Libxml2 includes complete XPath, XPointer and Xinclude implementations. It also has a SAX like interface, which is designed to be compatible with Expat." +HOMEPAGE = "http://www.xmlsoft.org/" +BUGTRACKER = "http://bugzilla.gnome.org/buglist.cgi?product=libxml2" +SECTION = "libs" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://Copyright;md5=2044417e2e5006b65a8b9067b683fcf1 \ + file://hash.c;beginline=6;endline=15;md5=96f7296605eae807670fb08947829969 \ + file://list.c;beginline=4;endline=13;md5=cdbfa3dee51c099edb04e39f762ee907 \ + file://trio.c;beginline=5;endline=14;md5=6c025753c86d958722ec76e94cae932e" + +DEPENDS_class-nativesdk = "nativesdk-python" +DEPENDS_class-native = "python-native" +DEPENDS =+ "zlib" + +SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz;name=libtar \ + file://libxml-64bit.patch \ + file://ansidecl.patch \ + file://runtest.patch \ + file://run-ptest \ + file://libxml2-CVE-2014-0191-fix.patch \ + file://python-sitepackages-dir.patch \ + file://libxml-m4-use-pkgconfig.patch \ + file://libxml2-CVE-2014-3660.patch \ + file://0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch \ + " + +BINCONFIG = "${bindir}/xml2-config" + +inherit autotools pkgconfig binconfig-disabled pythonnative ptest + +RDEPENDS_${PN}-ptest += "python-core" + +RDEPENDS_${PN}-ptest_append_libc-glibc += "glibc-gconv-ebcdic-us glibc-gconv-ibm1141" + +# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header +do_configure_prepend () { + sed -i -e '/.*ansidecl.h.*/d' ${S}/configure.in +} + +do_configure_prepend_class-nativesdk () { + # Ensure we get the correct site-packages path + export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}" +} + +# WARNING: zlib is require for RPM use +EXTRA_OECONF = "--without-python --without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions" +EXTRA_OECONF_class-native = "--with-python=${STAGING_BINDIR}/python --without-legacy --without-docbook --with-c14n --without-lzma --with-zlib" +EXTRA_OECONF_class-nativesdk = "--with-python=${STAGING_BINDIR}/python --without-legacy --without-docbook --with-c14n --without-lzma --with-zlib" +EXTRA_OECONF_linuxstdbase = "--without-python --with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib" + +# required for pythong binding +export HOST_SYS +export BUILD_SYS +export STAGING_LIBDIR +export STAGING_INCDIR + +export LDFLAGS += "-ldl" + +python populate_packages_prepend () { + # autonamer would call this libxml2-2, but we don't want that + if d.getVar('DEBIAN_NAMES', True): + d.setVar('PKG_libxml2', '${MLPREFIX}libxml2') +} + +PACKAGES += "${PN}-utils ${PN}-python" + +FILES_${PN}-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug" +FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" +FILES_${PN}-dev += "${libdir}/xml2Conf.sh" +FILES_${PN}-utils += "${bindir}/*" +FILES_${PN}-python += "${PYTHON_SITEPACKAGES_DIR}" + +do_install_ptest () { + cp -r ${WORKDIR}/xmlconf ${D}${PTEST_PATH} +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-core/libxml/libxml2/0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch b/meta/recipes-core/libxml/libxml2/0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch new file mode 100644 index 0000000000..96d58f9dd6 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch @@ -0,0 +1,181 @@ +From 213f1fe0d76d30eaed6e5853057defc43e6df2c9 Mon Sep 17 00:00:00 2001 +From: Daniel Veillard +Date: Tue, 14 Apr 2015 17:41:48 +0800 +Subject: [PATCH] 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. + +Upstream-Status: Backport + +Signed-off-by: Yue Tao +Signed-off-by: Wenzong Fan +--- + 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 + #include + #include ++#include /* 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) { +-- +1.7.9.5 + diff --git a/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch b/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch new file mode 100644 index 0000000000..10a8112b58 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch @@ -0,0 +1,30 @@ +From 72a46a519ce7326d9a00f0b6a7f2a8e958cd1675 Mon Sep 17 00:00:00 2001 +From: Daniel Veillard +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 + +Upstream-Status: Backport + +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; +-- +cgit v0.10.1 + diff --git a/meta/recipes-core/libxml/libxml2/ansidecl.patch b/meta/recipes-core/libxml/libxml2/ansidecl.patch new file mode 100644 index 0000000000..2452d780d5 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/ansidecl.patch @@ -0,0 +1,25 @@ +Sadly cmake is broken. If it sees this reference and ansidecl is present, it will add a +dependency upon it, even if HAVE_ANSIDEC_H is never set. + +The easiest solution is to remove these lines, otherwise recipes like libzypp can have a +dependency on the ansidecl.h header via cmake. This can lead to odd results if the +header is removed (clean binutils) and then the code is recompiled. + +RP 2012/7/10 + +Upstream-Status: Inappropriate [its really a cmake bug] + +Index: libxml2-2.8.0/include/libxml/xmlversion.h.in +=================================================================== +--- libxml2-2.8.0.orig/include/libxml/xmlversion.h.in 2012-07-10 11:51:52.460750573 +0000 ++++ libxml2-2.8.0/include/libxml/xmlversion.h.in 2012-07-10 11:52:41.436749397 +0000 +@@ -401,9 +401,6 @@ + #endif + + #ifdef __GNUC__ +-#ifdef HAVE_ANSIDECL_H +-#include +-#endif + + /** + * ATTRIBUTE_UNUSED: diff --git a/meta/recipes-core/libxml/libxml2/libxml-64bit.patch b/meta/recipes-core/libxml/libxml2/libxml-64bit.patch new file mode 100644 index 0000000000..1147017b61 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/libxml-64bit.patch @@ -0,0 +1,22 @@ +Upstream-Status: Backport [from debian: bugs.debian.org/439843] + +--- + libxml.h | 3 +++ + 1 file changed, 3 insertions(+) + +--- libxml2-2.6.29.orig/libxml.h ++++ libxml2-2.6.29/libxml.h +@@ -11,10 +11,13 @@ + + #ifndef NO_LARGEFILE_SOURCE + #ifndef _LARGEFILE_SOURCE + #define _LARGEFILE_SOURCE + #endif ++#ifndef _LARGEFILE64_SOURCE ++#define _LARGEFILE64_SOURCE ++#endif + #ifndef _FILE_OFFSET_BITS + #define _FILE_OFFSET_BITS 64 + #endif + #endif + diff --git a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch new file mode 100644 index 0000000000..0fc84070ed --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch @@ -0,0 +1,204 @@ +AM_PATH_XML2 uses xml-config which we disable through +binconfig-disabled.bbclass, so port it to use pkg-config instead. + +Upstream-Status: Pending +Signed-off-by: Ross Burton + +diff --git a/libxml.m4 b/libxml.m4 +index 68cd824..5fa0a9b 100644 +--- a/libxml.m4 ++++ b/libxml.m4 +@@ -1,188 +1,12 @@ +-# Configure paths for LIBXML2 +-# Mike Hommey 2004-06-19 +-# use CPPFLAGS instead of CFLAGS +-# Toshio Kuratomi 2001-04-21 +-# Adapted from: +-# Configure paths for GLIB +-# Owen Taylor 97-11-3 +- + dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) + dnl Test for XML, and define XML_CPPFLAGS and XML_LIBS + dnl +-AC_DEFUN([AM_PATH_XML2],[ +-AC_ARG_WITH(xml-prefix, +- [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)], +- xml_config_prefix="$withval", xml_config_prefix="") +-AC_ARG_WITH(xml-exec-prefix, +- [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)], +- xml_config_exec_prefix="$withval", xml_config_exec_prefix="") +-AC_ARG_ENABLE(xmltest, +- [ --disable-xmltest Do not try to compile and run a test LIBXML program],, +- enable_xmltest=yes) +- +- if test x$xml_config_exec_prefix != x ; then +- xml_config_args="$xml_config_args" +- if test x${XML2_CONFIG+set} != xset ; then +- XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config +- fi +- fi +- if test x$xml_config_prefix != x ; then +- xml_config_args="$xml_config_args --prefix=$xml_config_prefix" +- if test x${XML2_CONFIG+set} != xset ; then +- XML2_CONFIG=$xml_config_prefix/bin/xml2-config +- fi +- fi +- +- AC_PATH_PROG(XML2_CONFIG, xml2-config, no) +- min_xml_version=ifelse([$1], ,2.0.0,[$1]) +- AC_MSG_CHECKING(for libxml - version >= $min_xml_version) +- no_xml="" +- if test "$XML2_CONFIG" = "no" ; then +- no_xml=yes +- else +- XML_CPPFLAGS=`$XML2_CONFIG $xml_config_args --cflags` +- XML_LIBS=`$XML2_CONFIG $xml_config_args --libs` +- xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \ +- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` +- xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \ +- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` +- xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \ +- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` +- if test "x$enable_xmltest" = "xyes" ; then +- ac_save_CPPFLAGS="$CPPFLAGS" +- ac_save_LIBS="$LIBS" +- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS" +- LIBS="$XML_LIBS $LIBS" +-dnl +-dnl Now check if the installed libxml is sufficiently new. +-dnl (Also sanity checks the results of xml2-config to some extent) +-dnl +- rm -f conf.xmltest +- AC_TRY_RUN([ +-#include +-#include +-#include +-#include +- +-int +-main() +-{ +- int xml_major_version, xml_minor_version, xml_micro_version; +- int major, minor, micro; +- char *tmp_version; +- +- system("touch conf.xmltest"); +- +- /* Capture xml2-config output via autoconf/configure variables */ +- /* HP/UX 9 (%@#!) writes to sscanf strings */ +- tmp_version = (char *)strdup("$min_xml_version"); +- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { +- printf("%s, bad version string from xml2-config\n", "$min_xml_version"); +- exit(1); +- } +- free(tmp_version); +- +- /* Capture the version information from the header files */ +- tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION); +- if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) { +- printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION"); +- exit(1); +- } +- free(tmp_version); +- +- /* Compare xml2-config output to the libxml headers */ +- if ((xml_major_version != $xml_config_major_version) || +- (xml_minor_version != $xml_config_minor_version) || +- (xml_micro_version != $xml_config_micro_version)) +- { +- printf("*** libxml header files (version %d.%d.%d) do not match\n", +- xml_major_version, xml_minor_version, xml_micro_version); +- printf("*** xml2-config (version %d.%d.%d)\n", +- $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version); +- return 1; +- } +-/* Compare the headers to the library to make sure we match */ +- /* Less than ideal -- doesn't provide us with return value feedback, +- * only exits if there's a serious mismatch between header and library. +- */ +- LIBXML_TEST_VERSION; +- +- /* Test that the library is greater than our minimum version */ +- if ((xml_major_version > major) || +- ((xml_major_version == major) && (xml_minor_version > minor)) || +- ((xml_major_version == major) && (xml_minor_version == minor) && +- (xml_micro_version >= micro))) +- { +- return 0; +- } +- else +- { +- printf("\n*** An old version of libxml (%d.%d.%d) was found.\n", +- xml_major_version, xml_minor_version, xml_micro_version); +- printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n", +- major, minor, micro); +- printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n"); +- printf("***\n"); +- printf("*** If you have already installed a sufficiently new version, this error\n"); +- printf("*** probably means that the wrong copy of the xml2-config shell script is\n"); +- printf("*** being found. The easiest way to fix this is to remove the old version\n"); +- printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n"); +- printf("*** correct copy of xml2-config. (In this case, you will have to\n"); +- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); +- printf("*** so that the correct libraries are found at run-time))\n"); +- } +- return 1; +-} +-],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) +- CPPFLAGS="$ac_save_CPPFLAGS" +- LIBS="$ac_save_LIBS" +- fi +- fi ++AC_DEFUN([AM_PATH_XML2],[ ++ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) + +- if test "x$no_xml" = x ; then +- AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)) +- ifelse([$2], , :, [$2]) +- else +- AC_MSG_RESULT(no) +- if test "$XML2_CONFIG" = "no" ; then +- echo "*** The xml2-config script installed by LIBXML could not be found" +- echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in" +- echo "*** your path, or set the XML2_CONFIG environment variable to the" +- echo "*** full path to xml2-config." +- else +- if test -f conf.xmltest ; then +- : +- else +- echo "*** Could not run libxml test program, checking why..." +- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS" +- LIBS="$LIBS $XML_LIBS" +- AC_TRY_LINK([ +-#include +-#include +-], [ LIBXML_TEST_VERSION; return 0;], +- [ echo "*** The test program compiled, but did not run. This usually means" +- echo "*** that the run-time linker is not finding LIBXML or finding the wrong" +- echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your" +- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" +- echo "*** to the installed location Also, make sure you have run ldconfig if that" +- echo "*** is required on your system" +- echo "***" +- echo "*** If you have an old version installed, it is best to remove it, although" +- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], +- [ echo "*** The test program failed to compile or link. See the file config.log for the" +- echo "*** exact error that occured. This usually means LIBXML was incorrectly installed" +- echo "*** or that you have moved LIBXML since it was installed. In the latter case, you" +- echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ]) +- CPPFLAGS="$ac_save_CPPFLAGS" +- LIBS="$ac_save_LIBS" +- fi +- fi ++ verdep=ifelse([$1], [], [], [>= $1]) ++ PKG_CHECK_MODULES(XML, [libxml-2.0 $verdep], [$2], [$3]) + +- XML_CPPFLAGS="" +- XML_LIBS="" +- ifelse([$3], , :, [$3]) +- fi ++ XML_CPPFLAGS=$XML_CFLAGS + AC_SUBST(XML_CPPFLAGS) +- AC_SUBST(XML_LIBS) +- rm -f conf.xmltest + ]) diff --git a/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch new file mode 100644 index 0000000000..1c05ae649e --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch @@ -0,0 +1,37 @@ +From: Daniel Veillard +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 + +Upstream-Status: Backport +Reference: https://access.redhat.com/security/cve/CVE-2014-0191 + +Signed-off-by: Daniel Veillard +Signed-off-by: Maxin B. John +--- +diff -Naur libxml2-2.9.1-orig/parser.c libxml2-2.9.1/parser.c +--- libxml2-2.9.1-orig/parser.c 2013-04-16 15:39:18.000000000 +0200 ++++ libxml2-2.9.1/parser.c 2014-05-07 13:35:46.883687946 +0200 +@@ -2595,6 +2595,20 @@ + 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/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch new file mode 100644 index 0000000000..b9621c93eb --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch @@ -0,0 +1,147 @@ +From be2a7edaf289c5da74a4f9ed3a0b6c733e775230 Mon Sep 17 00:00:00 2001 +From: Daniel Veillard +Date: Thu, 16 Oct 2014 13:59:47 +0800 +Subject: Fix for CVE-2014-3660 + +Issues related to the billion laugh entity expansion which happened to +escape the initial set of fixes + +Upstream-status: Backport +Reference: https://git.gnome.org/browse/libxml2/commit/?id=be2a7edaf289c5da74a4f9ed3a0b6c733e775230&context=3&ignorews=0&ss=0 + +Signed-off-by: Joe MacDonald + +diff --git a/parser.c b/parser.c +index f51e8d2..1d93967 100644 +--- a/parser.c ++++ b/parser.c +@@ -130,6 +130,29 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size, + return (0); + if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) + return (1); ++ ++ /* ++ * This may look absurd but is needed to detect ++ * entities problems ++ */ ++ if ((ent != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && ++ (ent->content != NULL) && (ent->checked == 0)) { ++ unsigned long oldnbent = ctxt->nbentities; ++ xmlChar *rep; ++ ++ ent->checked = 1; ++ ++ rep = xmlStringDecodeEntities(ctxt, ent->content, ++ XML_SUBSTITUTE_REF, 0, 0, 0); ++ ++ ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; ++ if (rep != NULL) { ++ if (xmlStrchr(rep, '<')) ++ ent->checked |= 1; ++ xmlFree(rep); ++ rep = NULL; ++ } ++ } + if (replacement != 0) { + if (replacement < XML_MAX_TEXT_LENGTH) + return(0); +@@ -189,9 +212,12 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size, + return (0); + } else { + /* +- * strange we got no data for checking just return ++ * strange we got no data for checking + */ +- return (0); ++ if (((ctxt->lastError.code != XML_ERR_UNDECLARED_ENTITY) && ++ (ctxt->lastError.code != XML_WAR_UNDECLARED_ENTITY)) || ++ (ctxt->nbentities <= 10000)) ++ return (0); + } + xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); + return (1); +@@ -2589,6 +2615,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { + name, NULL); + ctxt->valid = 0; + } ++ xmlParserEntityCheck(ctxt, 0, NULL, 0); + } else if (ctxt->input->free != deallocblankswrapper) { + input = xmlNewBlanksWrapperInputStream(ctxt, entity); + if (xmlPushInput(ctxt, input) < 0) +@@ -2759,6 +2786,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, + if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) || + (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR)) + goto int_error; ++ xmlParserEntityCheck(ctxt, 0, ent, 0); + if (ent != NULL) + ctxt->nbentities += ent->checked / 2; + if ((ent != NULL) && +@@ -2810,6 +2838,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, + ent = xmlParseStringPEReference(ctxt, &str); + if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) + goto int_error; ++ xmlParserEntityCheck(ctxt, 0, ent, 0); + if (ent != NULL) + ctxt->nbentities += ent->checked / 2; + if (ent != NULL) { +@@ -7312,6 +7341,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { + (ret != XML_WAR_UNDECLARED_ENTITY)) { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, + "Entity '%s' failed to parse\n", ent->name); ++ xmlParserEntityCheck(ctxt, 0, ent, 0); + } else if (list != NULL) { + xmlFreeNodeList(list); + list = NULL; +@@ -7418,7 +7448,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { + /* + * We are copying here, make sure there is no abuse + */ +- ctxt->sizeentcopy += ent->length; ++ ctxt->sizeentcopy += ent->length + 5; + if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy)) + return; + +@@ -7466,7 +7496,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { + /* + * We are copying here, make sure there is no abuse + */ +- ctxt->sizeentcopy += ent->length; ++ ctxt->sizeentcopy += ent->length + 5; + if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy)) + return; + +@@ -7652,6 +7682,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) { + ctxt->sax->reference(ctxt->userData, name); + } + } ++ xmlParserEntityCheck(ctxt, 0, ent, 0); + ctxt->valid = 0; + } + +@@ -7845,6 +7876,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) { + "Entity '%s' not defined\n", + name); + } ++ xmlParserEntityCheck(ctxt, 0, ent, 0); + /* TODO ? check regressions ctxt->valid = 0; */ + } + +@@ -8004,6 +8036,7 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt) + name, NULL); + ctxt->valid = 0; + } ++ xmlParserEntityCheck(ctxt, 0, NULL, 0); + } else { + /* + * Internal checking in case the entity quest barfed +@@ -8243,6 +8276,7 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) { + name, NULL); + ctxt->valid = 0; + } ++ xmlParserEntityCheck(ctxt, 0, NULL, 0); + } else { + /* + * Internal checking in case the entity quest barfed +-- +cgit v0.10.1 + diff --git a/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch b/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch new file mode 100644 index 0000000000..a697ddf873 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch @@ -0,0 +1,21 @@ +Allow us to pass in PYTHON_SITE_PACKAGES + +The python binary used when building for nativesdk doesn't give us the +correct path here so we need to be able to specify it ourselves. + +Upstream-Status: Inappropriate [config] + +Signed-off-by: Paul Eggleton + +--- a/configure.in ++++ b/configure.in +@@ -743,7 +743,8 @@ dnl + + PYTHON_VERSION= + PYTHON_INCLUDES= +-PYTHON_SITE_PACKAGES= ++# Allow this to be set externally ++#PYTHON_SITE_PACKAGES= + PYTHON_TESTS= + pythondir= + if test "$with_python" != "no" ; then diff --git a/meta/recipes-core/libxml/libxml2/run-ptest b/meta/recipes-core/libxml/libxml2/run-ptest new file mode 100644 index 0000000000..473d0b67a7 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/run-ptest @@ -0,0 +1,3 @@ +#!/bin/sh + +make -k runtests diff --git a/meta/recipes-core/libxml/libxml2/runtest.patch b/meta/recipes-core/libxml/libxml2/runtest.patch new file mode 100644 index 0000000000..397ab20c30 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/runtest.patch @@ -0,0 +1,820 @@ +Add 'install-ptest' rule. +Print a standard result line for each test. + +Signed-off-by: Mihaela Sendrea +Upstream-Status: Pending + +diff -uNr a/Makefile.am b/Makefile.am +--- a/Makefile.am 2013-04-17 14:51:42.633386477 +0200 ++++ b/Makefile.am 2013-04-19 14:47:51.544720568 +0200 +@@ -202,10 +202,19 @@ + #testOOM_DEPENDENCIES = $(DEPS) + #testOOM_LDADD= $(LDADDS) + ++install-ptest: ++ @(if [ -d .libs ] ; then cd .libs; fi; \ ++ install $(noinst_PROGRAMS) $(DESTDIR)) ++ cp -r $(srcdir)/test $(DESTDIR) ++ cp -r $(srcdir)/result $(DESTDIR) ++ cp -r $(srcdir)/python $(DESTDIR) ++ cp Makefile $(DESTDIR) ++ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile ++ + runtests: + [ -d test ] || $(LN_S) $(srcdir)/test . + [ -d result ] || $(LN_S) $(srcdir)/result . +- $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT) ++ ./runtest$(EXEEXT) ; ./testrecurse$(EXEEXT) ; ./testapi$(EXEEXT) ; ./testchar$(EXEEXT) ; ./testdict$(EXEEXT) ; ./runxmlconf$(EXEEXT) + @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \ + $(MAKE) tests ; fi) + +diff -uNr a/runsuite.c b/runsuite.c +--- a/runsuite.c 2013-04-12 16:17:11.462823238 +0200 ++++ b/runsuite.c 2013-04-17 14:07:24.352693211 +0200 +@@ -1162,6 +1162,7 @@ + + if (logfile != NULL) + fclose(logfile); ++ printf("%s: runsuite\n\n", (ret == 0) ? "PASS" : "FAIL"); + return(ret); + } + #else /* !SCHEMAS */ +diff -uNr a/runtest.c b/runtest.c +--- a/runtest.c 2013-04-16 13:19:15.087997290 +0200 ++++ b/runtest.c 2013-04-17 14:08:29.529949655 +0200 +@@ -4386,6 +4386,7 @@ + err++; + } + } ++ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc); + return(err); + } + +@@ -4455,6 +4456,7 @@ + xmlCleanupParser(); + xmlMemoryDump(); + ++ printf("%s: runtest\n\n", (ret == 0) ? "PASS" : "FAIL"); + return(ret); + } + +diff -uNr a/runxmlconf.c b/runxmlconf.c +--- a/runxmlconf.c 2013-04-16 12:53:49.900982990 +0200 ++++ b/runxmlconf.c 2013-04-17 14:09:21.111778104 +0200 +@@ -595,6 +595,7 @@ + + if (logfile != NULL) + fclose(logfile); ++ printf("%s: runxmlconf\n", (ret == 0) ? "PASS" : "FAIL"); + return(ret); + } + +diff -uNr a/testapi.c b/testapi.c +--- a/testapi.c 2013-04-12 16:16:57.763417659 +0200 ++++ b/testapi.c 2013-04-17 14:10:28.876924881 +0200 +@@ -1245,49 +1245,91 @@ + testlibxml2(void) + { + int test_ret = 0; ++ int ret = 0; + +- test_ret += test_HTMLparser(); +- test_ret += test_HTMLtree(); +- test_ret += test_SAX2(); +- test_ret += test_c14n(); +- test_ret += test_catalog(); +- test_ret += test_chvalid(); +- test_ret += test_debugXML(); +- test_ret += test_dict(); +- test_ret += test_encoding(); +- test_ret += test_entities(); +- test_ret += test_hash(); +- test_ret += test_list(); +- test_ret += test_nanoftp(); +- test_ret += test_nanohttp(); +- test_ret += test_parser(); +- test_ret += test_parserInternals(); +- test_ret += test_pattern(); +- test_ret += test_relaxng(); +- test_ret += test_schemasInternals(); +- test_ret += test_schematron(); +- test_ret += test_tree(); +- test_ret += test_uri(); +- test_ret += test_valid(); +- test_ret += test_xinclude(); +- test_ret += test_xmlIO(); +- test_ret += test_xmlautomata(); +- test_ret += test_xmlerror(); +- test_ret += test_xmlmodule(); +- test_ret += test_xmlreader(); +- test_ret += test_xmlregexp(); +- test_ret += test_xmlsave(); +- test_ret += test_xmlschemas(); +- test_ret += test_xmlschemastypes(); +- test_ret += test_xmlstring(); +- test_ret += test_xmlunicode(); +- test_ret += test_xmlwriter(); +- test_ret += test_xpath(); +- test_ret += test_xpathInternals(); +- test_ret += test_xpointer(); ++ test_ret += (ret = test_HTMLparser()); ++ printf("%s: HTMLparser\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_HTMLtree()); ++ printf("%s: HTMLtree\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_SAX2()); ++ printf("%s: SAX2\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_c14n()); ++ printf("%s: c14n\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_catalog()); ++ printf("%s: catalog\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_chvalid()); ++ printf("%s: chvalid\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_debugXML()); ++ printf("%s: debugXML\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_dict()); ++ printf("%s: dict\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_encoding()); ++ printf("%s: encoding\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_entities()); ++ printf("%s: entities\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_hash()); ++ printf("%s: hash\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_list()); ++ printf("%s: list\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_nanoftp()); ++ printf("%s: nanoftp\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_nanohttp()); ++ printf("%s: nanohttp\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_parser()); ++ printf("%s: parser\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_parserInternals()); ++ printf("%s: parserInternals\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_pattern()); ++ printf("%s: pattern\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_relaxng()); ++ printf("%s: relaxng\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_schemasInternals()); ++ printf("%s: schemasInternals\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_schematron()); ++ printf("%s: schematron\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_tree()); ++ printf("%s: tree\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_uri()); ++ printf("%s: uri\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_valid()); ++ printf("%s: valid\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xinclude()); ++ printf("%s: xinclude\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlIO()); ++ printf("%s: xmlIO\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlautomata()); ++ printf("%s: xmlautomata\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlerror()); ++ printf("%s: xmlerror\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlmodule()); ++ printf("%s: xmlmodule\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlreader()); ++ printf("%s: xmlreader\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlregexp()); ++ printf("%s: xmlregexp\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlsave()); ++ printf("%s: xmlsave\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlschemas()); ++ printf("%s: xmlschemas\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlschemastypes()); ++ printf("%s: xmlschemastypes\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlstring()); ++ printf("%s: xmlstring\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlunicode()); ++ printf("%s: xmlunicode\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xmlwriter()); ++ printf("%s: xmlwriter\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xpath()); ++ printf("%s: xpath\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xpathInternals()); ++ printf("%s: xpathInternals\n", (ret == 0) ? "PASS" : "FAIL"); ++ test_ret += (ret = test_xpointer()); ++ printf("%s: xpointer\n", (ret == 0) ? "PASS" : "FAIL"); + + printf("Total: %d functions, %d tests, %d errors\n", + function_tests, call_tests, test_ret); ++ ++ printf("%s: testapi\n\n", (test_ret == 0) ? "PASS" : "FAIL"); + return(test_ret); + } + +diff -uNr a/testchar.c b/testchar.c +--- a/testchar.c 2013-04-17 10:50:30.250147418 +0200 ++++ b/testchar.c 2013-04-18 16:11:28.455733800 +0200 +@@ -23,7 +23,7 @@ + char document1[100] = "XXXX"; + char document2[100] = ""; + +-static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, ++static int testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, + int len, char *data, int forbid1, int forbid2) { + int i; + xmlDocPtr res; +@@ -37,33 +37,41 @@ + res = xmlReadMemory(document, len, "test", NULL, 0); + + if ((i == forbid1) || (i == forbid2)) { +- if ((lastError == 0) || (res != NULL)) ++ if ((lastError == 0) || (res != NULL)) { + fprintf(stderr, + "Failed to detect invalid char for Byte 0x%02X: %c\n", + i, i); ++ return(1); ++ } + } + + else if ((i == '<') || (i == '&')) { +- if ((lastError == 0) || (res != NULL)) ++ if ((lastError == 0) || (res != NULL)) { + fprintf(stderr, + "Failed to detect illegal char %c for Byte 0x%02X\n", i, i); ++ return(1); ++ } + } + else if (((i < 0x20) || (i >= 0x80)) && + (i != 0x9) && (i != 0xA) && (i != 0xD)) { +- if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) ++ if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) { + fprintf(stderr, + "Failed to detect invalid char for Byte 0x%02X\n", i); ++ return(1); ++ } + } + else if (res == NULL) { + fprintf(stderr, + "Failed to parse valid char for Byte 0x%02X : %c\n", i, i); ++ return(1); + } + if (res != NULL) + xmlFreeDoc(res); + } ++ return(0); + } + +-static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, ++static int testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, + int len, char *data) { + int i, j; + xmlDocPtr res; +@@ -80,10 +88,12 @@ + + /* if first bit of first char is set, then second bit must too */ + if ((i & 0x80) && ((i & 0x40) == 0)) { +- if ((lastError == 0) || (res != NULL)) ++ if ((lastError == 0) || (res != NULL)) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", + i, j); ++ return(1); ++ } + } + + /* +@@ -91,10 +101,12 @@ + * bits must be 10 + */ + else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { +- if ((lastError == 0) || (res != NULL)) ++ if ((lastError == 0) || (res != NULL)) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", + i, j); ++ return(1); ++ } + } + + /* +@@ -102,10 +114,12 @@ + * than 0x80, i.e. one of bits 5 to 1 of i must be set + */ + else if ((i & 0x80) && ((i & 0x1E) == 0)) { +- if ((lastError == 0) || (res != NULL)) ++ if ((lastError == 0) || (res != NULL)) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", + i, j); ++ return(1); ++ } + } + + /* +@@ -113,10 +127,12 @@ + * at least 3 bytes, but we give only 2 ! + */ + else if ((i & 0xE0) == 0xE0) { +- if ((lastError == 0) || (res != NULL)) ++ if ((lastError == 0) || (res != NULL)) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", + i, j); ++ return(1); ++ } + } + + /* +@@ -125,11 +141,13 @@ + else if ((lastError != 0) || (res == NULL)) { + fprintf(stderr, + "Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j); ++ return(1); + } + if (res != NULL) + xmlFreeDoc(res); + } + } ++ return(0); + } + + /** +@@ -141,9 +159,10 @@ + * CDATA in text or in attribute values. + */ + +-static void testDocumentRanges(void) { ++static int testDocumentRanges(void) { + xmlParserCtxtPtr ctxt; + char *data; ++ int test_ret = 0; + + /* + * Set up a parsing context using the first document as +@@ -152,7 +171,7 @@ + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + fprintf(stderr, "Failed to allocate parser context\n"); +- return; ++ return(1); + } + + printf("testing 1 byte char in document: 1"); +@@ -163,7 +182,7 @@ + data[2] = ' '; + data[3] = ' '; + /* test 1 byte injection at beginning of area */ +- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), ++ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), + data, -1, -1); + printf(" 2"); + fflush(stdout); +@@ -172,7 +191,7 @@ + data[2] = ' '; + data[3] = ' '; + /* test 1 byte injection at end of area */ +- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), ++ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), + data + 3, -1, -1); + + printf(" 3"); +@@ -183,7 +202,7 @@ + data[2] = ' '; + data[3] = ' '; + /* test 1 byte injection at beginning of area */ +- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), ++ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), + data, '\'', -1); + printf(" 4"); + fflush(stdout); +@@ -192,7 +211,7 @@ + data[2] = ' '; + data[3] = ' '; + /* test 1 byte injection at end of area */ +- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), ++ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), + data + 3, '\'', -1); + printf(" done\n"); + +@@ -204,7 +223,7 @@ + data[2] = ' '; + data[3] = ' '; + /* test 2 byte injection at beginning of area */ +- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), ++ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), + data); + printf(" 2"); + fflush(stdout); +@@ -213,7 +232,7 @@ + data[2] = ' '; + data[3] = ' '; + /* test 2 byte injection at end of area */ +- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), ++ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), + data + 2); + + printf(" 3"); +@@ -224,7 +243,7 @@ + data[2] = ' '; + data[3] = ' '; + /* test 2 byte injection at beginning of area */ +- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), ++ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), + data); + printf(" 4"); + fflush(stdout); +@@ -233,14 +252,15 @@ + data[2] = ' '; + data[3] = ' '; + /* test 2 byte injection at end of area */ +- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), ++ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), + data + 2); + printf(" done\n"); + + xmlFreeParserCtxt(ctxt); ++ return(test_ret); + } + +-static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { ++static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { + int i = 0; + int len, c; + +@@ -255,19 +275,25 @@ + c = xmlCurrentChar(ctxt, &len); + if ((i == 0) || (i >= 0x80)) { + /* we must see an error there */ +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Byte 0x%02X\n", i); ++ return(1); ++ } + } else if (i == 0xD) { +- if ((c != 0xA) || (len != 1)) ++ if ((c != 0xA) || (len != 1)) { + fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i); ++ return(1); ++ } + } else if ((c != i) || (len != 1)) { + fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i); ++ return(1); + } + } ++ return(0); + } + +-static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { ++static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { + int i, j; + int len, c; + +@@ -284,10 +310,12 @@ + + /* if first bit of first char is set, then second bit must too */ + if ((i & 0x80) && ((i & 0x40) == 0)) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", + i, j); ++ return(1); ++ } + } + + /* +@@ -295,10 +323,12 @@ + * bits must be 10 + */ + else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", + i, j, c); ++ return(1); ++ } + } + + /* +@@ -306,10 +336,12 @@ + * than 0x80, i.e. one of bits 5 to 1 of i must be set + */ + else if ((i & 0x80) && ((i & 0x1E) == 0)) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", + i, j, c); ++ return(1); ++ } + } + + /* +@@ -317,10 +349,12 @@ + * at least 3 bytes, but we give only 2 ! + */ + else if ((i & 0xE0) == 0xE0) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", + i, j); ++ return(1); ++ } + } + + /* +@@ -329,6 +363,7 @@ + else if ((lastError != 0) || (len != 2)) { + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j); ++ return(1); + } + + /* +@@ -338,12 +373,14 @@ + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n", + i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c); ++ return(1); + } + } + } ++ return(0); + } + +-static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { ++static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { + int i, j, k, K; + int len, c; + unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; +@@ -368,20 +405,24 @@ + * at least 4 bytes, but we give only 3 ! + */ + if ((i & 0xF0) == 0xF0) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + i, j, K, data[3]); ++ return(1); ++ } + } + + /* + * The second and the third bytes must start with 10 + */ + else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", + i, j, K); ++ return(1); ++ } + } + + /* +@@ -390,10 +431,12 @@ + * the 6th byte of data[1] must be set + */ + else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", + i, j, K); ++ return(1); ++ } + } + + /* +@@ -401,10 +444,12 @@ + */ + else if (((value > 0xD7FF) && (value <0xE000)) || + ((value > 0xFFFD) && (value <0x10000))) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n", + value, i, j, K); ++ return(1); ++ } + } + + /* +@@ -414,6 +459,7 @@ + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", + i, j, K); ++ return(1); + } + + /* +@@ -423,13 +469,15 @@ + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", + i, j, data[2], value, c); ++ return(1); + } + } + } + } ++ return(0); + } + +-static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { ++static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { + int i, j, k, K, l, L; + int len, c; + unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; +@@ -458,10 +506,12 @@ + * at least 5 bytes, but we give only 4 ! + */ + if ((i & 0xF8) == 0xF8) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + i, j, K, data[3]); ++ return(1); ++ } + } + + /* +@@ -469,10 +519,12 @@ + */ + else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) || + ((L & 0xC0) != 0x80)) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + i, j, K, L); ++ return(1); ++ } + } + + /* +@@ -481,10 +533,12 @@ + * the 6 or 5th byte of j must be set + */ + else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + i, j, K, L); ++ return(1); ++ } + } + + /* +@@ -493,10 +547,12 @@ + else if (((value > 0xD7FF) && (value <0xE000)) || + ((value > 0xFFFD) && (value <0x10000)) || + (value > 0x10FFFF)) { +- if (lastError != XML_ERR_INVALID_CHAR) ++ if (lastError != XML_ERR_INVALID_CHAR) { + fprintf(stderr, + "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + value, i, j, K, L); ++ return(1); ++ } + } + + /* +@@ -506,6 +562,7 @@ + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", + i, j, K); ++ return(1); + } + + /* +@@ -515,11 +572,13 @@ + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", + i, j, data[2], value, c); ++ return(1); + } + } + } + } + } ++ return(0); + } + + /** +@@ -530,11 +589,12 @@ + * cover the full range of UTF-8 chars accepted by XML-1.0 + */ + +-static void testCharRanges(void) { ++static int testCharRanges(void) { + char data[5]; + xmlParserCtxtPtr ctxt; + xmlParserInputBufferPtr buf; + xmlParserInputPtr input; ++ int test_ret = 0; + + memset(data, 0, 5); + +@@ -545,17 +605,19 @@ + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + fprintf(stderr, "Failed to allocate parser context\n"); +- return; ++ return(1); + } + buf = xmlParserInputBufferCreateStatic(data, sizeof(data), + XML_CHAR_ENCODING_NONE); + if (buf == NULL) { + fprintf(stderr, "Failed to allocate input buffer\n"); ++ test_ret = 1; + goto error; + } + input = xmlNewInputStream(ctxt); + if (input == NULL) { + xmlFreeParserInputBuffer(buf); ++ test_ret = 1; + goto error; + } + input->filename = NULL; +@@ -567,25 +629,28 @@ + + printf("testing char range: 1"); + fflush(stdout); +- testCharRangeByte1(ctxt, data); ++ test_ret += testCharRangeByte1(ctxt, data); + printf(" 2"); + fflush(stdout); +- testCharRangeByte2(ctxt, data); ++ test_ret += testCharRangeByte2(ctxt, data); + printf(" 3"); + fflush(stdout); +- testCharRangeByte3(ctxt, data); ++ test_ret += testCharRangeByte3(ctxt, data); + printf(" 4"); + fflush(stdout); +- testCharRangeByte4(ctxt, data); ++ test_ret += testCharRangeByte4(ctxt, data); + printf(" done\n"); + fflush(stdout); + + error: + xmlFreeParserCtxt(ctxt); ++ return(test_ret); + } + + int main(void) { + ++ int ret = 0; ++ + /* + * this initialize the library and check potential ABI mismatches + * between the version it was compiled for and the actual shared +@@ -602,8 +667,9 @@ + /* + * Run the tests + */ +- testCharRanges(); +- testDocumentRanges(); ++ ret += testCharRanges(); ++ ret += testDocumentRanges(); ++ printf("%s: testchar\n\n", (ret == 0) ? "PASS" : "FAIL"); + + /* + * Cleanup function for the XML library. +diff -uNr a/testdict.c b/testdict.c +--- a/testdict.c 2013-04-16 15:08:42.971177193 +0200 ++++ b/testdict.c 2013-04-18 15:59:00.699482439 +0200 +@@ -440,5 +440,6 @@ + clean_strings(); + xmlCleanupParser(); + xmlMemoryDump(); ++ printf("%s: testdict\n\n", (ret == 0) ? "PASS" : "FAIL"); + return(ret); + } +diff -uNr a/testlimits.c b/testlimits.c +--- a/testlimits.c 2013-04-12 16:16:36.180354177 +0200 ++++ b/testlimits.c 2013-04-17 14:03:17.203092987 +0200 +@@ -1630,5 +1630,6 @@ + xmlCleanupParser(); + xmlMemoryDump(); + ++ printf("%s: testlimits\n", (ret == 0) ? "PASS" : "FAIL"); + return(ret); + } +diff -uNr a/testrecurse.c b/testrecurse.c +--- a/testrecurse.c 2013-04-16 13:19:49.366536295 +0200 ++++ b/testrecurse.c 2013-04-17 14:06:27.367091622 +0200 +@@ -892,6 +892,7 @@ + err++; + } + } ++ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc); + return(err); + } + +@@ -961,5 +962,6 @@ + xmlCleanupParser(); + xmlMemoryDump(); + ++ printf("%s: testrecurse\n\n", (ret == 0) ? "PASS" : "FAIL"); + return(ret); + } diff --git a/meta/recipes-core/libxml/libxml2_2.9.1.bb b/meta/recipes-core/libxml/libxml2_2.9.1.bb new file mode 100644 index 0000000000..e087324590 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2_2.9.1.bb @@ -0,0 +1,9 @@ +require libxml2.inc + +SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;name=testtar \ + file://72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch" + +SRC_URI[libtar.md5sum] = "9c0cfef285d5c4a5c80d00904ddab380" +SRC_URI[libtar.sha256sum] = "fd3c64cb66f2c4ea27e934d275904d92cec494a8e8405613780cbc8a71680fdb" +SRC_URI[testtar.md5sum] = "ae3d1ebe000a3972afa104ca7f0e1b4a" +SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7" -- cgit v1.2.3-54-g00ecf