15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0 s11-update
authorPetr Sumbera <petr.sumbera@oracle.com>
Thu, 20 Dec 2012 04:53:01 -0800
branchs11-update
changeset 2452 9dc4dfa4b04d
parent 2451 f54396da08ea
child 2454 82b8521a2f38
15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0 15769048 SUNBT7133962 xml schema validation fails on valid docs 15808846 problem in LIBRARY/LIBXML
components/bind/Makefile
components/libxml2/Makefile
components/libxml2/libxml.3
components/libxml2/libxml2.license
components/libxml2/libxml2.p5m
components/libxml2/mapfile
components/libxml2/patches/02.globals-fix.patch
components/libxml2/patches/03.globals.patch
components/libxml2/patches/04.libxml2-01-remove-static.patch
components/libxml2/patches/05.mem-leak-fix.patch
components/libxml2/patches/06.no-docs-examples.patch
components/libxml2/patches/07.proto-mismatch.patch
components/libxml2/patches/08.CVE-2010-4494.patch
components/libxml2/patches/09.CVE-2011-1944.patch
components/libxml2/patches/10.CVE-2011-0216.patch
components/libxml2/patches/11.CVE-2011-2821.patch
components/libxml2/patches/12.CVE-2011-2834.patch
components/libxml2/patches/13.CVE-2011-3905.patch
components/libxml2/patches/14.CVE-2011-3919.patch
components/libxml2/patches/15.lib-run-path-fix.patch
components/libxml2/patches/16.python-makefile.patch
components/libxml2/patches/17.CVE-2010-4008.patch
components/libxml2/patches/18.CVE-2011-3102.patch
components/libxml2/patches/19.CVE-2012-0841.patch
components/libxml2/patches/21.runtest.patch
components/libxml2/patches/22.htmlSetMetaEncoding.patch
components/libxml2/patches/23.xpathleak.patch
components/libxml2/patches/PTHREAD_ONCE_INIT.patch
components/libxml2/patches/bug684774.patch
components/libxml2/patches/man.patch
components/libxml2/patches/mapfile.patch
components/libxml2/patches/test_errors_name2.patch
components/libxml2/xml2-config.1
components/libxml2/xmlcatalog.1
components/libxml2/xmllint.1
components/php-5_2/php-sapi/patches/13_php_libxml_2_9_0.patch
components/php-5_3/php-sapi/patches/134_php_libxml_2_9_0.patch
--- a/components/bind/Makefile	Wed Dec 19 02:21:27 2012 -0800
+++ b/components/bind/Makefile	Thu Dec 20 04:53:01 2012 -0800
@@ -61,6 +61,10 @@
 CONFIGURE_OPTIONS +=	--disable-openssl-version-check
 CONFIGURE_OPTIONS +=	--enable-fixed-rrset
 CONFIGURE_OPTIONS +=	--with-pkcs11
+# Bind configure will check for libxml2 versions 2.6.x/2.7.x/2.8.x.
+# To make it use version 2.9.x we need to skip this check by
+# specifying path where libxml2 is installed.
+CONFIGURE_OPTIONS +=	--with-libxml2=/usr
 
 CONFIGURE_OPTIONS +=	CFLAGS="$(CFLAGS)"
 # Configure will add "-mt" to CC which is already set in CFLAGS, so override.
--- a/components/libxml2/Makefile	Wed Dec 19 02:21:27 2012 -0800
+++ b/components/libxml2/Makefile	Thu Dec 20 04:53:01 2012 -0800
@@ -26,19 +26,19 @@
 include ../../make-rules/shared-macros.mk
 
 COMPONENT_NAME=		libxml2
-COMPONENT_VERSION=	2.7.6
+COMPONENT_VERSION=	2.9.0
 COMPONENT_PROJECT_URL=	http://xmlsoft.org/
 COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
 COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:238c4f0203c012e5776522640c0fb3ac532c4064981c1ce3e74c00b75501d761
+    sha256:ad25d91958b7212abdc12b9611cfb4dc4e5cddb6d1e9891532f48aacee422b82
 COMPONENT_ARCHIVE_URL=	ftp://xmlsoft.org/libxml2/$(COMPONENT_ARCHIVE)
 COMPONENT_BUGDB=	library/libxml
 
 # W3C XML Conformance Test Suites
-COMPONENT_ARCHIVE_1= xmlts20080205.tar.gz
+COMPONENT_ARCHIVE_1= xmlts20080827.tar.gz
 COMPONENT_ARCHIVE_HASH_1= \
-    sha256:39ffe4a61be4187aac4b64b8fd34aa01bb004387527a1ec5dc9c8dd794a2562e
+    sha256:96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7
 COMPONENT_ARCHIVE_URL_1= http://www.w3.org/XML/Test/$(COMPONENT_ARCHIVE_1)
 
 include ../../make-rules/prep.mk
@@ -53,16 +53,14 @@
 CONFIGURE_OPTIONS += --with-pic
 CONFIGURE_OPTIONS += --with-threads
 CONFIGURE_OPTIONS += --with-python=$(PYTHON.$(BITS))
+# Cannot link to lzma since it's not in /lib.
+CONFIGURE_OPTIONS += --without-lzma
 CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
 CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)"
 CONFIGURE_OPTIONS += PYTHON_VENDOR_PACKAGES=$(PYTHON_VENDOR_PACKAGES)
 
-COMPONENT_PREP_ACTION =  (cd $(@D) ; gtar xf $(COMPONENT_DIR)/$(COMPONENT_ARCHIVE_1));
 COMPONENT_PREP_ACTION += (cd $(@D) ; cp ../mapfile libxml2.syms ; autoreconf -if)
 
-# Internal test suit needs data files ready.
-COMPONENT_PRE_CONFIGURE_ACTION = ($(CLONEY) $(SOURCE_DIR) $(@D))
-
 # After we have configured, make a copy of the python bits so we
 # can build separate python 2.7 support.
 COMPONENT_POST_CONFIGURE_ACTION = (cd $(@D) ; cp -rp python python2.7 ; \
@@ -73,6 +71,7 @@
 COMPONENT_POST_INSTALL_ACTION = \
     (cd $(@D)/python2.7 ; $(GMAKE) $(COMPONENT_INSTALL_ARGS) install)
 
+COMPONENT_PRE_TEST_ACTION = (cd $(@D) ; gtar xf $(COMPONENT_DIR)/$(COMPONENT_ARCHIVE_1))
 
 # common targets
 build:		$(BUILD_32_and_64)
--- a/components/libxml2/libxml.3	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-.TH libxml 3 "23 May 2002"
-.SH NAME
-libxml \- library used to parse XML files
-.SH DESCRIPTION
-The
-.I  libxml
-library is used to parse XML files. 
-Its internal document repesentation is as close as possible to the 
-.I DOM 
-(Document Object Model) interface,
-an API for accessing XML or HTML structured documents.
-.LP
-The
-.I libxml
-library also has a 
-.IR SAX -like
-interface, 
-which is designed to be compatible with that of another XML parser library
-called 
-.IR expat.
-NOTE:
-.IR SAX , 
-the Simple API for XML,
-is a standard interface for event-based XML parsing,
-developed collaboratively by the members of the XML-DEV mailing list, 
-currently hosted by OASIS.
-The
-.I expat
-library is a XML 1.0 parser written in C,
-which aims to be fully conforming. 
-It is currently not a validating XML processor.
-.LP
-The
-.I libxml 
-library now includes a nearly complete 
-.I XPath 
-implementation. 
-The
-.I XPath
-(XML Path Language) is a language for addressing parts of an 
-XML document,
-designed to be used by both 
-.I XSLT 
-and 
-.IR XPointer .
-.LP
-The
-.I libxml 
-library exports Push and Pull type parser interfaces for both XML and 
-.IR html . 
-.SH FILES
-.TP 2.2i
-.B /usr/lib/libxml2.so
-shareable library
-.TP
-.B /usr/bin/xmlcatalog
-binary application for parsing and manipulating XML or SGML catalog files
-.TP
-.B /usr/bin/xmllint
-binary application for parsing XML files
-.TP
-.B /usr/bin/xml2-config
-binary application for printing library configuration
-.TP
-.B /usr/include/libxml2
-header files
-.SH AUTHORS
-Daniel Veillard ([email protected]).
-If you download and install this package please send the author email.
-Manual page by Ziying Sherwin ([email protected]),
-Lister Hill National Center for Biomedical Communications,
-U.S. National Library of Medicine.
-.\" end of manual page
-.SH SEE ALSO
-.IR xmlcatalog (1),
-.IR xmllint (1),
-.IR xml2-config (1).
--- a/components/libxml2/libxml2.license	Wed Dec 19 02:21:27 2012 -0800
+++ b/components/libxml2/libxml2.license	Thu Dec 20 04:53:01 2012 -0800
@@ -1,5 +1,5 @@
 -----------------
-- libxml2 2.7.6 -
+- libxml2 2.9.0 -
 -----------------
 
 Oracle Internal Tracking Number 5302
--- a/components/libxml2/libxml2.p5m	Wed Dec 19 02:21:27 2012 -0800
+++ b/components/libxml2/libxml2.p5m	Thu Dec 20 04:53:01 2012 -0800
@@ -106,10 +106,10 @@
 file llib-lxml2 path=usr/lib/llib-lxml2
 file path=usr/lib/pkgconfig/libxml-2.0.pc
 file path=usr/share/aclocal/libxml.m4
-file xml2-config.1 path=usr/share/man/man1/xml2-config.1
-file xmlcatalog.1 path=usr/share/man/man1/xmlcatalog.1
-file xmllint.1 path=usr/share/man/man1/xmllint.1
-file libxml.3 path=usr/share/man/man3/libxml.3
+file path=usr/share/man/man1/xml2-config.1
+file path=usr/share/man/man1/xmlcatalog.1
+file path=usr/share/man/man1/xmllint.1
+file path=usr/share/man/man3/libxml.3
 file libxml2.3 path=usr/share/man/man3/libxml2.3
 legacy pkg=SUNWlxml desc="The XML library" name="The XML library"
 license libxml2.license license="libxml license"
--- a/components/libxml2/mapfile	Wed Dec 19 02:21:27 2012 -0800
+++ b/components/libxml2/mapfile	Thu Dec 20 04:53:01 2012 -0800
@@ -32,12 +32,35 @@
 #
 # Note that the source above actually lives in the ON tree.
 #
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 # public interfaces in libxml2
 #
 $mapfile_version 2
 
+SYMBOL_VERSION SUNW_1.9 {
+	global:
+		# LIBXML2_2.8.0
+		xmlTextReaderRelaxNGValidateCtxt;
+		xmlBufferDetach;
+		xmlInitializeDict;
+
+		# LIBXML2_2.9.0
+		xmlBufContent;
+		xmlBufEnd;
+		xmlBufGetNodeContent;
+		xmlBufNodeDump;
+		xmlBufShrink;
+		xmlBufUse;
+		xmlDictGetUsage;
+		xmlDictSetLimit;
+		xmlSchemaValidateSetFilename;
+		xmlSchemaValidateSetLocator;
+		xmlOutputBufferGetContent;
+		xmlOutputBufferGetSize;
+		xmlTextWriterSetQuoteChar;
+} SUNW_1.8;
+
 SYMBOL_VERSION SUNW_1.8 {
 	global:
 		xmlChildElementCount;
@@ -522,10 +545,7 @@
 		xmlLastError;
 		xmlMallocAtomic;
 		xmlParserMaxDepth;
-		xmlSaveNoEmptyTagsThrDef;
 		xmlStructuredError;
-		xmlUnicodeBlockTbl;
-		xmlUnicodeCatTbl;
 } SUNW_1.3;
 
 SYMBOL_VERSION SUNW_1.3 {
@@ -1271,7 +1291,6 @@
 		xmlNanoHTTPClose;
 		xmlNanoHTTPContentLength;
 		xmlNanoHTTPFetch;
-		xmlNanoHTTPFetchContent;
 		xmlNanoHTTPInit;
 		xmlNanoHTTPMethod;
 		xmlNanoHTTPMethodRedir;
@@ -1312,7 +1331,6 @@
 		xmlNewParserCtxt;
 		xmlNewProp;
 		xmlNewRMutex;
-		xmlNewReconciliedNs;
 		xmlNewReference;
 		xmlNewStringInputStream;
 		xmlNewText;
@@ -1354,7 +1372,6 @@
 		xmlParseCDSect;
 		xmlParseCatalogFile;
 		xmlParseCharData;
-		xmlParseCharDataComplex;
 		xmlParseCharEncoding;
 		xmlParseCharRef;
 		xmlParseChunk;
@@ -1401,8 +1418,6 @@
 		xmlParseReference;
 		xmlParseSDDecl;
 		xmlParseStartTag;
-		xmlParseStringEntityRef;
-		xmlParseStringPEReference;
 		xmlParseSystemLiteral;
 		xmlParseTextDecl;
 		xmlParseURI;
@@ -1469,7 +1484,6 @@
 		xmlSaveFormatFileEnc;
 		xmlSaveFormatFileTo;
 		xmlSaveUri;
-		xmlScanAttributeDecl;
 		xmlScanName;
 		xmlSearchNs;
 		xmlSearchNsByHref;
@@ -1714,11 +1728,9 @@
 		xmlXPatherror;
 		xmlXPtrAdvanceNode;
 		xmlXPtrBuildNodeList;
-		xmlXPtrEndPointFunction;
 		xmlXPtrEval;
 		xmlXPtrEvalRangePredicate;
 		xmlXPtrFreeLocationSet;
-		xmlXPtrHereFunction;
 		xmlXPtrLocationSetAdd;
 		xmlXPtrLocationSetCreate;
 		xmlXPtrLocationSetDel;
@@ -1734,12 +1746,7 @@
 		xmlXPtrNewRangeNodes;
 		xmlXPtrNewRangePointNode;
 		xmlXPtrNewRangePoints;
-		xmlXPtrOriginFunction;
-		xmlXPtrRangeFunction;
-		xmlXPtrRangeInsideFunction;
 		xmlXPtrRangeToFunction;
-		xmlXPtrStartPointFunction;
-		xmlXPtrStringRangeFunction;
 		xmlXPtrWrapLocationSet;
 		docbDefaultSAXHandler;
 		htmlDefaultSAXHandler;
@@ -1771,7 +1778,6 @@
 		xmlTreeIndentString;
 		xmlXPathNAN;
 		xmlXPathNINF;
-		xmlXPathNZERO;
 		xmlXPathPINF;
 	local:
 		*;
--- a/components/libxml2/patches/02.globals-fix.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- libxml2-2.7.6/globals.c.fix	Tue Oct 13 20:13:06 2009
-+++ libxml2-2.7.6/globals.c	Tue Oct 13 20:13:28 2009
[email protected]@ -46,7 +46,7 @@
-  */
- void xmlInitGlobals(void)
- {
--    if (xmlThrDefMutex != NULL)
-+    if (xmlThrDefMutex == NULL)
-         xmlThrDefMutex = xmlNewMutex();
- }
- 
--- a/components/libxml2/patches/03.globals.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
---- libxml2-2.7.6/xpointer.c	Thu Sep 24 08:32:00 2009
-+++ libxml2-2.7.3/xpointer.c	Wed Jan  3 05:07:52 2007
[email protected]@ -1301,19 +1299,12 @@
-  *									*
-  ************************************************************************/
- 
--static
- void xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs);
--static
- void xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs);
--static
- void xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs);
--static
- void xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs);
--static
- void xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs);
--static
- void xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs);
--static
- void xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs);
- 
- /**
[email protected]@ -1741,7 +1732,7 @@
-  * Function implementing here() operation 
-  * as described in 5.4.3
-  */
--static void
-+void
- xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs) {
-     CHECK_ARITY(0);
- 
[email protected]@ -1759,7 +1750,7 @@
-  * Function implementing origin() operation 
-  * as described in 5.4.3
-  */
--static void
-+void
- xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs) {
-     CHECK_ARITY(0);
- 
[email protected]@ -1792,7 +1783,7 @@
-  * ----------------
-  *
-  */
--static void
-+void
- xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
-     xmlXPathObjectPtr tmp, obj, point;
-     xmlLocationSetPtr newset = NULL;
[email protected]@ -1886,7 +1877,7 @@
-  *   syntax error.
-  * ----------------------------
-  */
--static void
-+void
- xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
-     xmlXPathObjectPtr tmp, obj, point;
-     xmlLocationSetPtr newset = NULL;
[email protected]@ -2031,7 +2022,7 @@
-  *  location-set, a range location representing the covering range of
-  *  x is added to the result location-set.
-  */
--static void
-+void
- xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
-     int i;
-     xmlXPathObjectPtr set;
[email protected]@ -2177,7 +2168,7 @@
-  *  location children of x.
-  *
-  */
--static void
-+void
- xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) {
-     int i;
-     xmlXPathObjectPtr set;
[email protected]@ -2765,7 +2757,7 @@
-  * all be character points.
-  * ------------------------------
-  */
--static void
-+void
- xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
-     int i, startindex, endindex = 0, fendindex;
-     xmlNodePtr start, end = 0, fend;
---- libxml2-2.7.6/tree.c	Thu Sep 24 08:32:00 2009
-+++ libxml2-2.7.3/tree.c	Sat Jan 17 05:45:34 2009
[email protected]@ -49,8 +49,7 @@
-  *									*
-  ************************************************************************/
- 
--static xmlNsPtr
--xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
-+xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
- 
- static xmlChar* xmlGetPropNodeValueInternal(xmlAttrPtr prop);
- 
[email protected]@ -6055,7 +6045,7 @@
-  * @tree or on one of its ancestors then a new prefix is generated.
-  * Returns the (new) namespace definition or NULL in case of error
-  */
--static xmlNsPtr
-+xmlNsPtr
- xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
-     xmlNsPtr def;
-     xmlChar prefix[50];
---- libxml2-2.7.6/valid.c	Thu Sep 24 08:32:00 2009
-+++ libxml2-2.7.3/valid.c	Thu Nov 27 06:04:13 2008
[email protected]@ -637,6 +637,8 @@
-    else if ((doc->intSubset == NULL) &&				\
- 	    (doc->extSubset == NULL)) return(0)
- 
-+xmlAttributePtr xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem);
-+
- #ifdef LIBXML_REGEXP_ENABLED
- 
- /************************************************************************
[email protected]@ -1831,6 +1833,53 @@
- 
- #ifdef LIBXML_VALID_ENABLED
- /**
-+ * xmlScanAttributeDeclCallback:
-+ * @attr:  the attribute decl
-+ * @list:  the list to update
-+ *
-+ * Callback called by xmlScanAttributeDecl when a new attribute
-+ * has to be entered in the list.
-+ */
-+static void
-+xmlScanAttributeDeclCallback(xmlAttributePtr attr, xmlAttributePtr *list,
-+	                     const xmlChar* name ATTRIBUTE_UNUSED) {
-+    attr->nexth = *list;
-+    *list = attr;
-+}
-+
-+/**
-+ * xmlScanAttributeDecl:
-+ * @dtd:  pointer to the DTD
-+ * @elem:  the element name
-+ *
-+ * When inserting a new element scan the DtD for existing attributes
-+ * for that element and initialize the Attribute chain
-+ *
-+ * Returns the pointer to the first attribute decl in the chain,
-+ *         possibly NULL.
-+ */
-+xmlAttributePtr
-+xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem) {
-+    xmlAttributePtr ret = NULL;
-+    xmlAttributeTablePtr table;
-+
-+    if (dtd == NULL) {
-+	return(NULL);
-+    }
-+    if (elem == NULL) {
-+	return(NULL);
-+    }
-+    table = (xmlAttributeTablePtr) dtd->attributes;
-+    if (table == NULL) 
-+        return(NULL);
-+
-+    /* WRONG !!! */
-+    xmlHashScan3(table, NULL, NULL, elem,
-+	        (xmlHashScanner) xmlScanAttributeDeclCallback, &ret);
-+    return(ret);
-+}
-+
-+/**
-  * xmlScanIDAttributeDecl:
-  * @ctxt:  the validation context
-  * @elem:  the element name
---- libxml2-2.7.6/parser.c	Thu Sep 24 08:31:59 2009
-+++ libxml2-2.7.3/parser.c	Thu Sep  3 08:28:43 2009
[email protected]@ -202,8 +198,8 @@
- 
- 
- /* DEPR void xmlParserHandleReference(xmlParserCtxtPtr ctxt); */
--static xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt,
--                                              const xmlChar **str);
-+xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt,
-+                                       const xmlChar **str);
- 
- static xmlParserErrors
- xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
[email protected]@ -1359,8 +1342,8 @@
-  *									*
-  ************************************************************************/
- 
--static xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt,
--                                            const xmlChar ** str);
-+xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt,
-+                                     const xmlChar ** str);
- 
- #ifdef SAX2
- /**
[email protected]@ -4015,7 +3978,7 @@
-     return(buf);
- }
- 
--static void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata);
-+void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata);
- 
- /*
-  * used for the test in the inner loop of the char data testing
[email protected]@ -4220,7 +4183,7 @@
-  * of xmlParseCharData() when the parsing requires handling
-  * of non-ASCII characters.
-  */
--static void
-+void
- xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
-     xmlChar buf[XML_PARSER_BIG_BUFFER_SIZE + 5];
-     int nbchar = 0;
[email protected]@ -7293,7 +7257,7 @@
-  * Returns the xmlEntityPtr if found, or NULL otherwise. The str pointer
-  * is updated to the current location in the string.
-  */
--static xmlEntityPtr
-+xmlEntityPtr
- xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
-     xmlChar *name;
-     const xmlChar *ptr;
[email protected]@ -7701,7 +7666,7 @@
-  * Returns the string of the entity content.
-  *         str is updated to the current value of the index
-  */
--static xmlEntityPtr
-+xmlEntityPtr
- xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
-     const xmlChar *ptr;
-     xmlChar cur;
--- a/components/libxml2/patches/04.libxml2-01-remove-static.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-*** libxml2-2.6.23/globals.c	Tue Aug 23 18:06:28 2005
---- libxml2-2.6.23.new/globals.c	Fri Apr  7 00:25:38 2006
-***************
-*** 344,350 ****
-   * Disabled by default
-   */
-  int xmlSaveNoEmptyTags = 0;
-! static int xmlSaveNoEmptyTagsThrDef = 0;
-  
-  #ifdef LIBXML_SAX1_ENABLED
-  /**
---- 344,350 ----
-   * Disabled by default
-   */
-  int xmlSaveNoEmptyTags = 0;
-! int xmlSaveNoEmptyTagsThrDef = 0;
-  
-  #ifdef LIBXML_SAX1_ENABLED
-  /**
-*** libxml2-2.6.23/nanohttp.c	Thu Dec 15 11:06:31 2005
---- libxml2-2.6.23.new/nanohttp.c	Fri Apr  7 00:33:19 2006
-***************
-*** 164,170 ****
-  static int proxyPort;	/* the proxy port if any */
-  static unsigned int timeout = 60;/* the select() timeout in seconds */
-  
-! static int xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len );
-  
-  /**
-   * xmlHTTPErrMemory:
---- 164,170 ----
-  static int proxyPort;	/* the proxy port if any */
-  static unsigned int timeout = 60;/* the select() timeout in seconds */
-  
-! int xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len );
-  
-  /**
-   * xmlHTTPErrMemory:
-***************
-*** 1710,1716 ****
-   * -1 if received content length was less than specified or an error 
-   * occurred.
-   */
-! static int
-  xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len ) {
-      xmlNanoHTTPCtxtPtr	ctxt = (xmlNanoHTTPCtxtPtr)ctx;
-  
---- 1710,1716 ----
-   * -1 if received content length was less than specified or an error 
-   * occurred.
-   */
-! int
-  xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len ) {
-      xmlNanoHTTPCtxtPtr	ctxt = (xmlNanoHTTPCtxtPtr)ctx;
-  
-*** libxml2-2.6.23/xmlunicode.c	Fri Jul 29 00:57:53 2005
---- libxml2-2.6.23.new/xmlunicode.c	Fri Apr  7 00:31:57 2006
-***************
-*** 926,933 ****
-      {0x205f, 0x205f}, {0x3000, 0x3000} };
-  static xmlChRangeGroup xmlZG = {9,0,xmlZS,NULL};
-  
-! static xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, 128};
-! static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, 36};
-  
-  /**
-   * xmlUnicodeLookup:
---- 926,933 ----
-      {0x205f, 0x205f}, {0x3000, 0x3000} };
-  static xmlChRangeGroup xmlZG = {9,0,xmlZS,NULL};
-  
-! xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, 128};
-! xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, 36};
-  
-  /**
-   * xmlUnicodeLookup:
-*** libxml2-2.6.23/xpath.c	Thu Jan  5 12:33:45 2006
---- libxml2-2.6.23.new/xpath.c	Fri Apr  7 00:58:49 2006
-***************
-*** 100,106 ****
-  double xmlXPathNAN = 0;
-  double xmlXPathPINF = 1;
-  double xmlXPathNINF = -1;
-! static double xmlXPathNZERO = 0; /* not exported from headers */
-  static int xmlXPathInitialized = 0;
-  
-  /**
---- 100,106 ----
-  double xmlXPathNAN = 0;
-  double xmlXPathPINF = 1;
-  double xmlXPathNINF = -1;
-! double xmlXPathNZERO = 0; /* not exported from headers */
-  static int xmlXPathInitialized = 0;
-  
-  /**
--- a/components/libxml2/patches/05.mem-leak-fix.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-diff --git a/python/tests/xpathleak.py b/python/tests/xpathleak.py
-index dcc144c..879de1c 100644
---- a/python/tests/xpathleak.py
-+++ b/python/tests/xpathleak.py
[email protected]@ -27,7 +27,11 @@ libxml2.registerErrorHandler(callback, "-->")
- doc = libxml2.parseDoc("<fish/>")
- ctxt = doc.xpathNewContext()
- ctxt.setContextNode(doc)
--for expr in (":false()","bad:()","bad(:)",":bad(:)","bad:(:)","bad:bad(:)"):
-+badexprs = (
-+	":false()", "bad:()", "bad(:)", ":bad(:)", "bad:(:)", "bad:bad(:)",
-+	"a:/b", "/c:/d", "//e:/f", "g://h"
-+	)
-+for expr in badexprs:
- 	try:
- 		ctxt.xpathEval(expr)
- 	except libxml2.xpathError, e:
-diff --git a/xpath.c b/xpath.c
-index 5b84d22..8482c40 100644
---- a/xpath.c
-+++ b/xpath.c
[email protected]@ -11333,6 +11333,7 @@ xmlXPathCompRelativeLocationPath
- 	SKIP_BLANKS;
-     }
-     xmlXPathCompStep(ctxt);
-+    CHECK_ERROR;
-     SKIP_BLANKS;
-     while (CUR == '/') {
- 	if ((CUR == '/') && (NXT(1) == '/')) {
[email protected]@ -11392,6 +11393,7 @@ xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt) {
- 		     (CUR == '@') || (CUR == '*')))
- 		    xmlXPathCompRelativeLocationPath(ctxt);
- 	    }
-+	    CHECK_ERROR;
- 	}
-     }
- }
-
--- a/components/libxml2/patches/06.no-docs-examples.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- libxml2-2.6.31.orig/Makefile.in	Fri Jan 11 01:10:54 2008
-+++ libxml2-2.6.31/Makefile.in	Wed Jan 16 14:33:06 2008
[email protected]@ -486,7 +486,7 @@
- target_alias = @[email protected]
- top_builddir = @[email protected]
- top_srcdir = @[email protected]
--SUBDIRS = include . doc example xstc @[email protected]
-+SUBDIRS = include . @[email protected]
- DIST_SUBDIRS = include . doc example python xstc
- INCLUDES = -I$(top_builddir)/include [email protected]@/include @[email protected] @[email protected] 
- bin_SCRIPTS = xml2-config
--- a/components/libxml2/patches/07.proto-mismatch.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- libxml2-2.7.6/relaxng.c.proto-mismatch	Thu Oct  8 00:39:20 2009
-+++ libxml2-2.7.6/relaxng.c	Thu Oct  8 00:41:57 2009
[email protected]@ -5369,7 +5369,7 @@
-     } else {
-         xmlRngPErr(ctxt, node, XML_RNGP_CHOICE_CONTENT,
-                    "expecting name, anyName, nsName or choice : got %s\n",
--                   (node == NULL ? "nothing" : node->name), NULL);
-+                   (node == NULL ? (const unsigned char *)"nothing" : node->name), NULL);
-         return (NULL);
-     }
-     if (ret != def) {
--- a/components/libxml2/patches/08.CVE-2010-4494.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
---- libxml2-2.7.6/xpath.c.orig	Mon Jun  6 11:10:14 2011
-+++ libxml2-2.7.6/xpath.c	Mon Jun  6 11:11:04 2011
[email protected]@ -11739,11 +11739,16 @@
- 
- 	    if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
- 	        xmlXPathObjectPtr tmp;
--		/* pop the result */
-+		/* pop the result if any */
- 		tmp = valuePop(ctxt);
--		xmlXPathReleaseObject(xpctxt, tmp);
--		/* then pop off contextObj, which will be freed later */
--		valuePop(ctxt);
-+		if (tmp != contextObj) {
-+		   /*
-+		    * Free up the result
-+		    * then pop off contextObj, which will be freed later
-+		    */
-+		   xmlXPathReleaseObject(xpctxt, tmp);
-+		   valuePop(ctxt);
-+		}
- 		goto evaluation_error;
- 	    }
- 
--- a/components/libxml2/patches/09.CVE-2011-1944.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
---- libxml2-2.7.6/xpath.c	Sun Sep 11 04:17:41 2011
-+++ libxml2-2.7.6/xpath.c.new	Sun Sep 11 04:38:33 2011
[email protected]@ -3522,13 +3522,13 @@
-     } else if (cur->nodeNr == cur->nodeMax) {
-         xmlNodePtr *temp;
- 
--        cur->nodeMax *= 2;
--	temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax *
-+	temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 *
- 				      sizeof(xmlNodePtr));
- 	if (temp == NULL) {
- 	    xmlXPathErrMemory(NULL, "growing nodeset\n");
- 	    return;
- 	}
-+	cur->nodeMax *= 2;
- 	cur->nodeTab = temp;
-     }
-     cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs(node, ns);
[email protected]@ -3575,8 +3575,7 @@
-     } else if (cur->nodeNr == cur->nodeMax) {
-         xmlNodePtr *temp;
- 
--        cur->nodeMax *= 2;
--	temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax *
-+	temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 *
- 				      sizeof(xmlNodePtr));
- 	if (temp == NULL) {
- 	    xmlXPathErrMemory(NULL, "growing nodeset\n");
[email protected]@ -3583,6 +3582,7 @@
- 	    return;
- 	}
- 	cur->nodeTab = temp;
-+	cur->nodeMax *= 2;
-     }
-     if (val->type == XML_NAMESPACE_DECL) {
- 	xmlNsPtr ns = (xmlNsPtr) val;
[email protected]@ -3627,8 +3627,7 @@
-     } else if (cur->nodeNr == cur->nodeMax) {
-         xmlNodePtr *temp;
- 
--        cur->nodeMax *= 2;
--	temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax *
-+	temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 *
- 				      sizeof(xmlNodePtr));
- 	if (temp == NULL) {
- 	    xmlXPathErrMemory(NULL, "growing nodeset\n");
[email protected]@ -3635,6 +3634,7 @@
- 	    return;
- 	}
- 	cur->nodeTab = temp;
-+	cur->nodeMax *= 2;
-     }
-     if (val->type == XML_NAMESPACE_DECL) {
- 	xmlNsPtr ns = (xmlNsPtr) val;
[email protected]@ -3738,8 +3738,7 @@
- 	} else if (val1->nodeNr == val1->nodeMax) {
- 	    xmlNodePtr *temp;
- 
--	    val1->nodeMax *= 2;
--	    temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax *
-+	    temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax * 2 *
- 					     sizeof(xmlNodePtr));
- 	    if (temp == NULL) {
- 	        xmlXPathErrMemory(NULL, "merging nodeset\n");
[email protected]@ -3746,6 +3745,7 @@
- 		return(NULL);
- 	    }
- 	    val1->nodeTab = temp;
-+	    val1->nodeMax *= 2;
- 	}
- 	if (n2->type == XML_NAMESPACE_DECL) {
- 	    xmlNsPtr ns = (xmlNsPtr) n2;
[email protected]@ -3800,8 +3800,7 @@
- 	} else if (val1->nodeNr == val1->nodeMax) {
- 	    xmlNodePtr *temp;
- 
--	    val1->nodeMax *= 2;
--	    temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax *
-+	    temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax * 2 *
- 					     sizeof(xmlNodePtr));
- 	    if (temp == NULL) {
- 	        xmlXPathErrMemory(NULL, "merging nodeset\n");
[email protected]@ -3808,6 +3807,7 @@
- 		return(NULL);
- 	    }
- 	    val1->nodeTab = temp;
-+	    val1->nodeMax *= 2;
- 	}
- 	if (val2->nodeTab[i]->type == XML_NAMESPACE_DECL) {
- 	    xmlNsPtr ns = (xmlNsPtr) val2->nodeTab[i];
[email protected]@ -3907,14 +3907,14 @@
- 	    } else if (set1->nodeNr >= set1->nodeMax) {
- 		xmlNodePtr *temp;
- 
--		set1->nodeMax *= 2;
- 		temp = (xmlNodePtr *) xmlRealloc(
--		    set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr));
-+		    set1->nodeTab, set1->nodeMax * 2 * sizeof(xmlNodePtr));
- 		if (temp == NULL) {
- 		    xmlXPathErrMemory(NULL, "merging nodeset\n");
- 		    return(NULL);
- 		}
- 		set1->nodeTab = temp;
-+		set1->nodeMax *= 2;
- 	    }
- 	    if (n2->type == XML_NAMESPACE_DECL) {
- 		xmlNsPtr ns = (xmlNsPtr) n2;
[email protected]@ -3991,14 +3991,14 @@
- 	    } else if (set1->nodeNr >= set1->nodeMax) {
- 		xmlNodePtr *temp;
- 
--		set1->nodeMax *= 2;
- 		temp = (xmlNodePtr *) xmlRealloc(
--		    set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr));
-+		    set1->nodeTab, set1->nodeMax * 2 * sizeof(xmlNodePtr));
- 		if (temp == NULL) {
- 		    xmlXPathErrMemory(NULL, "merging nodeset\n");
- 		    return(NULL);
- 		}
- 		set1->nodeTab = temp;
-+		set1->nodeMax *= 2;
- 	    }
- 	    set1->nodeTab[set1->nodeNr++] = n2;
- 	}
--- a/components/libxml2/patches/10.CVE-2011-0216.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-This patch taken directly from upstream:
-http://git.gnome.org/browse/libxml2/commit/?id=69f04562f75212bfcabecd190ea8b06ace28ece2
---- libxml2-2.7.6/encoding.c	Thu Sep 24 08:31:59 2009
-+++ libxml2-2.7.6/new.encoding.c	Mon Oct 24 11:11:46 2011
[email protected]@ -1771,7 +1771,7 @@
-     if (in == NULL) return(-1);
- 
-     /* calculate space available */
--    written = out->size - out->use;
-+    written = out->size - out->use - 1; /* count '\0' */
-     toconv = in->use;
-     /*
-      * echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
[email protected]@ -1892,7 +1892,7 @@
-     toconv = in->use;
-     if (toconv == 0)
-         return (0);
--    written = out->size - out->use;
-+    written = out->size - out->use - 1; /* count '\0' */
-     if (toconv * 2 >= written) {
-         xmlBufferGrow(out, out->size + toconv * 2);
-         written = out->size - out->use - 1;
--- a/components/libxml2/patches/11.CVE-2011-2821.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-The contents of this patch taken directly from upstream:
-http://git.gnome.org/browse/libxml2/commit/?id=f5048b3e71fc30ad096970b8df6e7af073bae4cb
-via copy/paste of the code changes into the source files from which I generated new
-patch diffs.  This explains the error of the missing 3 lines that are concatenated
-to the bottom of this patch.
---- libxml2-2.7.6/xpath.c	Wed Nov 30 08:31:34 2011
-+++ libxml2-2.7.6/new.xpath.c	Wed Nov 30 08:30:31 2011
[email protected]@ -252,6 +252,7 @@
-     "Encoding error\n",
-     "Char out of XML range\n",
-     "Invalid or incomplete context\n",
-+    "Stack usage error\n",
-     "?? Unknown error ??\n"	/* Must be last in the list! */
- };
- #define MAXERRNO ((int)(sizeof(xmlXPathErrorMessages) /	\
[email protected]@ -2398,6 +2399,42 @@
-  ************************************************************************/
- 
- /**
-+ * xmlXPathSetFrame:
-+ * @ctxt: an XPath parser context
-+ *
-+ * Set the callee evaluation frame
-+ *
-+ * Returns the previous frame value to be restored once done
-+ */
-+static int
-+xmlXPathSetFrame(xmlXPathParserContextPtr ctxt) {
-+    int ret;
-+
-+    if (ctxt == NULL)
-+	return(0);
-+    ret = ctxt->valueFrame;
-+    ctxt->valueFrame = ctxt->valueNr;
-+    return(ret);
-+}
-+
-+/**
-+ * xmlXPathPopFrame:
-+ * @ctxt: an XPath parser context
-+ * @frame: the previous frame value
-+ *
-+ * Remove the callee evaluation frame
-+ */
-+static void
-+xmlXPathPopFrame(xmlXPathParserContextPtr ctxt, int frame) {
-+    if (ctxt == NULL)
-+	return;
-+    if (ctxt->valueNr < ctxt->valueFrame) {
-+	xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
-+    }
-+    ctxt->valueFrame = frame;
-+}
-+
-+/**
-  * valuePop:
-  * @ctxt: an XPath evaluation context
-  *
[email protected]@ -2412,6 +2449,12 @@
- 
-     if ((ctxt == NULL) || (ctxt->valueNr <= 0))
-         return (NULL);
-+
-+    if (ctxt->valueNr <= ctxt->valueFrame) {
-+	xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
-+	return (NULL);
-+    }
-+
-     ctxt->valueNr--;
-     if (ctxt->valueNr > 0)
-         ctxt->value = ctxt->valueTab[ctxt->valueNr - 1];
[email protected]@ -6154,6 +6197,7 @@
-     ret->valueNr = 0;
-     ret->valueMax = 10;
-     ret->value = NULL;
-+    ret->valueFrame = 0;
- 
-     ret->context = ctxt;
-     ret->comp = comp;
[email protected]@ -11688,6 +11732,7 @@
- 	xmlXPathObjectPtr contextObj = NULL, exprRes = NULL;
- 	xmlNodePtr oldContextNode, contextNode = NULL;
- 	xmlXPathContextPtr xpctxt = ctxt->context;
-+	int frame;
- 
- #ifdef LIBXML_XPTR_ENABLED
- 	    /*
[email protected]@ -11707,6 +11752,8 @@
- 	*/
- 	exprOp = &ctxt->comp->steps[op->ch2];
- 	for (i = 0; i < set->nodeNr; i++) {
-+	    xmlXPathObjectPtr tmp;
-+
- 	    if (set->nodeTab[i] == NULL)
- 		continue;
- 
[email protected]@ -11738,19 +11785,18 @@
- 	    res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
- 
- 	    if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
--	        xmlXPathObjectPtr tmp;
--		/* pop the result if any */
--		tmp = valuePop(ctxt);
--		if (tmp != contextObj) {
-+		while (tmp != contextObj) {
- 		   /*
- 		    * Free up the result
- 		    * then pop off contextObj, which will be freed later
- 		    */
- 		   xmlXPathReleaseObject(xpctxt, tmp);
--		   valuePop(ctxt);
-+		   tmp = valuePop(ctxt);
- 		}
- 		goto evaluation_error;
- 	    }
-+	    /* push the result back onto the stack */
-+	    valuePush(ctxt, tmp);
- 
- 	    if (res)
- 		pos++;
[email protected]@ -13354,7 +13400,9 @@
-                 xmlXPathFunction func;
-                 const xmlChar *oldFunc, *oldFuncURI;
- 		int i;
-+		int frame;
- 
-+		frame = xmlXPathSetFrame(ctxt);
-                 if (op->ch1 != -1)
-                     total +=
-                         xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
[email protected]@ -13362,15 +13410,18 @@
- 		    xmlGenericError(xmlGenericErrorContext,
- 			    "xmlXPathCompOpEval: parameter error\n");
- 		    ctxt->error = XPATH_INVALID_OPERAND;
-+		    xmlXPathPopFrame(ctxt, frame);
- 		    return (total);
- 		}
--		for (i = 0; i < op->value; i++)
-+		for (i = 0; i < op->value; i++) {
- 		    if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) {
- 			xmlGenericError(xmlGenericErrorContext,
- 				"xmlXPathCompOpEval: parameter error\n");
- 			ctxt->error = XPATH_INVALID_OPERAND;
-+			xmlXPathPopFrame(ctxt, frame);
- 			return (total);
- 		    }
-+		}
-                 if (op->cache != NULL)
-                     XML_CAST_FPTR(func) = op->cache;
-                 else {
[email protected]@ -13386,6 +13437,7 @@
-                             xmlGenericError(xmlGenericErrorContext,
-             "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
-                                     (char *)op->value4, (char *)op->value5);
-+			    xmlXPathPopFrame(ctxt, frame);
-                             return (total);
-                         }
-                         func = xmlXPathFunctionLookupNS(ctxt->context,
[email protected]@ -13407,6 +13459,7 @@
-                 func(ctxt, op->value);
-                 ctxt->context->function = oldFunc;
-                 ctxt->context->functionURI = oldFuncURI;
-+		xmlXPathPopFrame(ctxt, frame);
-                 return (total);
-             }
-         case XPATH_OP_ARG:
[email protected]@ -14310,6 +14363,7 @@
- 	ctxt->valueNr = 0;
- 	ctxt->valueMax = 10;
- 	ctxt->value = NULL;
-+	ctxt->valueFrame = 0;
-     }
- #ifdef XPATH_STREAMING
-     if (ctxt->comp->stream) {
---- libxml2-2.7.6/include/libxml/xpath.h	Thu Sep 24 08:31:59 2009
-+++ libxml2-2.7.6/include/libxml/new.xpath.h	Mon Oct 24 11:21:50 2011
[email protected]@ -68,7 +68,8 @@
-     XPATH_UNDEF_PREFIX_ERROR,
-     XPATH_ENCODING_ERROR,
-     XPATH_INVALID_CHAR_ERROR,
--    XPATH_INVALID_CTXT
-+    XPATH_INVALID_CTXT,
-+    XPATH_STACK_ERROR
- } xmlXPathError;
- 
- /*
[email protected]@ -380,6 +381,8 @@
-     xmlXPathCompExprPtr comp;		/* the precompiled expression */
-     int xptr;				/* it this an XPointer expression */
-     xmlNodePtr         ancestor;	/* used for walking preceding axis */
-+
-+    int              valueFrame;	/* used to limit Pop on the stack */
- };
- 
- /************************************************************************
---- libxml2-2.7.6/xpointer.c	Mon Oct 24 11:18:07 2011
-+++ libxml2-2.7.6/new.xpointer.c	Mon Oct 24 11:42:52 2011
[email protected]@ -1269,6 +1269,7 @@
- 	ctxt->valueNr = 0;
- 	ctxt->valueMax = 10;
- 	ctxt->value = NULL;
-+	ctxt->valueFrame = 0;
-     }
-     SKIP_BLANKS;
-     if (CUR == '/') {
-
---- libxml2-2.7.6/xpath.c	Thu Jan  5 10:51:16 2012
-+++ libxml2-2.7.6/xpath.c.new	Thu Jan  5 11:00:39 2012
[email protected]@ -11781,8 +11781,11 @@
- 		xmlXPathNodeSetAddUnique(contextObj->nodesetval,
- 		    contextNode);
- 
-+	    frame = xmlXPathSetFrame(ctxt);
- 	    valuePush(ctxt, contextObj);
- 	    res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
-+	    tmp = valuePop(ctxt);
-+	    xmlXPathPopFrame(ctxt, frame);
- 
- 	    if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
- 		while (tmp != contextObj) {
-
--- a/components/libxml2/patches/12.CVE-2011-2834.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-This patch taken directly from upstream:
-http://git.gnome.org/browse/libxml2/commit/?id=1d4526f6f4ec8d18c40e2a09b387652a6c1aa2cd
---- libxml2-2.7.6/xpath.c	Fri Dec  9 06:34:26 2011
-+++ libxml2-2.7.6/new.xpath.c	Fri Dec  9 06:43:12 2011
[email protected]@ -2485,6 +2485,7 @@
-                                              sizeof(ctxt->valueTab[0]));
-         if (tmp == NULL) {
-             xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
-+	    ctxt->error = XPATH_MEMORY_ERROR;
-             return (0);
-         }
-         ctxt->valueMax *= 2;
[email protected]@ -9327,6 +9328,7 @@
- 		if ( (ch & 0xc0) != 0xc0 ) {
- 		    xmlGenericError(xmlGenericErrorContext,
- 			"xmlXPathTranslateFunction: Invalid UTF8 string\n");
-+		    /* not asserting an XPath error is probably better */
- 		    break;
- 		}
- 		/* then skip over remaining bytes for this char */
[email protected]@ -9334,6 +9336,7 @@
- 		    if ( (*cptr++ & 0xc0) != 0x80 ) {
- 			xmlGenericError(xmlGenericErrorContext,
- 			    "xmlXPathTranslateFunction: Invalid UTF8 string\n");
-+			/* not asserting an XPath error is probably better */
- 			break;
- 		    }
- 		if (ch & 0x80) /* must have had error encountered */
[email protected]@ -13384,6 +13387,7 @@
-                         xmlGenericError(xmlGenericErrorContext,
-             "xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n",
-                                     (char *) op->value4, (char *)op->value5);
-+			ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
-                         return (total);
-                     }
- 		    val = xmlXPathVariableLookupNS(ctxt->context,
[email protected]@ -13438,6 +13442,7 @@
-             "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
-                                     (char *)op->value4, (char *)op->value5);
- 			    xmlXPathPopFrame(ctxt, frame);
-+			    ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
-                             return (total);
-                         }
-                         func = xmlXPathFunctionLookupNS(ctxt->context,
[email protected]@ -14016,6 +14021,7 @@
-     }
-     xmlGenericError(xmlGenericErrorContext,
-                     "XPath: unknown precompiled operation %d\n", op->op);
-+    ctxt->error = XPATH_INVALID_OPERAND;
-     return (total);
- }
- 
--- a/components/libxml2/patches/13.CVE-2011-3905.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-This patch copied/pasted from this link:
-http://git.gnome.org/browse/libxml2/patch/?id=77404b8b69bc122d12231807abf1a837d121b551
-----------------------------------------------------------------------
-From 77404b8b69bc122d12231807abf1a837d121b551 Mon Sep 17 00:00:00 2001
-From: Chris Evans <[email protected]>
-Date: Wed, 14 Dec 2011 08:18:25 +0000
-Subject: Make sure the parser returns when getting a Stop order
-
-patch backported from chromiun bug fixes, assuming author is Chris
----
-diff --git a/parser.c b/parser.c
-index 21d7aa3..4e5dcb9 100644
---- a/parser.c
-+++ b/parser.c
[email protected]@ -4949,7 +4949,8 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
- 		    (ctxt->sax->processingInstruction != NULL))
- 		    ctxt->sax->processingInstruction(ctxt->userData,
- 		                                     target, NULL);
--		ctxt->instate = state;
-+		if (ctxt->instate != XML_PARSER_EOF)
-+		    ctxt->instate = state;
- 		return;
- 	    }
- 	    buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
[email protected]@ -5029,7 +5030,8 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
- 	} else {
- 	    xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL);
- 	}
--	ctxt->instate = state;
-+	if (ctxt->instate != XML_PARSER_EOF)
-+	    ctxt->instate = state;
-     }
- }
- 
[email protected]@ -9589,6 +9591,8 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
-     else
- 	name = xmlParseStartTag(ctxt);
- #endif /* LIBXML_SAX1_ENABLED */
-+    if (ctxt->instate == XML_PARSER_EOF)
-+	return;
-     if (name == NULL) {
- 	spacePop(ctxt);
-         return;
[email protected]@ -10975,6 +10979,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
- 		else
- 		    name = xmlParseStartTag(ctxt);
- #endif /* LIBXML_SAX1_ENABLED */
-+		if (ctxt->instate == XML_PARSER_EOF)
-+		    goto done;
- 		if (name == NULL) {
- 		    spacePop(ctxt);
- 		    ctxt->instate = XML_PARSER_EOF;
[email protected]@ -11161,7 +11167,9 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
- 		  else
- 		    xmlParseEndTag1(ctxt, 0);
- #endif /* LIBXML_SAX1_ENABLED */
--		if (ctxt->nameNr == 0) {
-+		if (ctxt->instate == XML_PARSER_EOF) {
-+		    /* Nothing */
-+		} else if (ctxt->nameNr == 0) {
- 		    ctxt->instate = XML_PARSER_EPILOG;
- 		} else {
- 		    ctxt->instate = XML_PARSER_CONTENT;
---
-cgit v0.9.0.2
-
--- a/components/libxml2/patches/14.CVE-2011-3919.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-This patch copied/pasted from this link:
-http://git.gnome.org/browse/libxml2/patch/?id=5bd3c061823a8499b27422aee04ea20aae24f03e
-----------------------------------------------------------------------
-From 5bd3c061823a8499b27422aee04ea20aae24f03e Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <[email protected]>
-Date: Fri, 16 Dec 2011 10:53:35 +0000
-Subject: Fix an allocation error when copying entities
-
----
-diff --git a/parser.c b/parser.c
-index 4e5dcb9..c55e41d 100644
---- a/parser.c
-+++ b/parser.c
[email protected]@ -2709,7 +2709,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
- 
- 		buffer[nbchars++] = '&';
- 		if (nbchars > buffer_size - i - XML_PARSER_BUFFER_SIZE) {
--		    growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
-+		    growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE);
- 		}
- 		for (;i > 0;i--)
- 		    buffer[nbchars++] = *cur++;
---
-cgit v0.9.0.2
-
--- a/components/libxml2/patches/15.lib-run-path-fix.patch	Wed Dec 19 02:21:27 2012 -0800
+++ b/components/libxml2/patches/15.lib-run-path-fix.patch	Thu Dec 20 04:53:01 2012 -0800
@@ -1,10 +1,10 @@
---- libxml2-2.7.6/xml2-config.in.orig	2012-02-28 07:50:52.740749322 -0800
-+++ libxml2-2.7.6/xml2-config.in	2012-02-28 07:51:50.794170795 -0800
+--- libxml2-2.9.0/xml2-config.in	Mon Sep 10 20:52:46 2012
++++ libxml2-2.9.0/xml2-config.in	Fri Oct 26 04:03:45 2012
 @@ -91,7 +91,7 @@
- 		echo @[email protected] @[email protected] 
+ 		echo @[email protected] @[email protected] @[email protected]
  	    fi
  	else
--	    echo @[email protected] @[email protected] @[email protected]
+-	    echo @[email protected] @[email protected] @[email protected] @[email protected]
 +	    echo -lxml2
  	fi
         	;;
--- a/components/libxml2/patches/16.python-makefile.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-This patch copied/pasted from this link:
-http://git.gnome.org/browse/libxml2/commit/?id=38af74f7b18af17097c1888bc4c96ab6a30e3bdf
-----------------------------------------------------------------------
-From 38af74f7b18af17097c1888bc4c96ab6a30e3bdf Mon Sep 17 00:00:00 2001
-From: Paul Smith <[email protected]>
-Date: Mon, 15 Mar 2010 09:22:25 +0000
-Subject: fix build error in libxml2/python
-
-There are missing $(srcdir) values in libxml2/python/Makefile.am which
-cause it to fail if built remote from out of tree.
----
-diff --git a/python/Makefile.am b/python/Makefile.am
-index 8f148b1..3cf87e7 100644
---- a/python/Makefile.am
-+++ b/python/Makefile.am
[email protected]@ -29,11 +29,11 @@ mylibs = \
- 
- python_LTLIBRARIES = libxml2mod.la
- 
--libxml2mod_la_SOURCES = libxml.c types.c
-+libxml2mod_la_SOURCES = $(srcdir)/libxml.c $(srcdir)/types.c
- nodist_libxml2mod_la_SOURCES = libxml2-py.c
- libxml2mod_la_LIBADD = $(mylibs) @[email protected] @[email protected]
- 
--libxml.c: libxml2-py.h # to generate before to compile
-+$(srcdir)/libxml.c: libxml2-py.h # to generate before to compile
- 
- 
- libxml2.py: $(srcdir)/libxml.py libxml2class.py
---
-cgit v0.9.0.2
--- a/components/libxml2/patches/17.CVE-2010-4008.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-There are 2 patches in a row to the same section of code here, they are copied/pasted
-directly from:
-http://git.gnome.org/browse/libxml2/patch/?id=91d19754d46acd4a639a8b9e31f50f31c78f8c9c
-http://git.gnome.org/browse/libxml2/patch/?id=ea90b894146030c214a7df6d8375310174f134b9
---------------------------------------------------------------------------------------
-From 91d19754d46acd4a639a8b9e31f50f31c78f8c9c Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <[email protected]>
-Date: Fri, 15 Oct 2010 12:30:52 +0000
-Subject: Fix the semantic of XPath axis for namespace/attribute context nodes
-
-The processing of namespace and attributes nodes was not compliant
-to the XPath-1.0 specification
----
-diff --git a/xpath.c b/xpath.c
-index b24ca69..8b77af3 100644
---- a/xpath.c
-+++ b/xpath.c
[email protected]@ -8106,8 +8106,16 @@ xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- xmlNodePtr
- xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
-     if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
--    if (cur != NULL && cur->children != NULL)
--        return cur->children ;
-+    if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
-+	(ctxt->context->node->type == XML_NAMESPACE_DECL))
-+	return(NULL);
-+    if (cur != NULL) {
-+        if ((cur->type == XML_ATTRIBUTE_NODE) ||
-+            (cur->type == XML_NAMESPACE_DECL))
-+            return(NULL);
-+        if (cur->children != NULL)
-+            return cur->children ;
-+    }
-     if (cur == NULL) cur = ctxt->context->node;
-     if (cur == NULL) return(NULL) ; /* ERROR */
-     if (cur->next != NULL) return(cur->next) ;
[email protected]@ -8162,6 +8170,9 @@ xmlNodePtr
- xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
- {
-     if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
-+    if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
-+	(ctxt->context->node->type == XML_NAMESPACE_DECL))
-+	return(NULL);
-     if (cur == NULL)
-         cur = ctxt->context->node;
-     if (cur == NULL)
[email protected]@ -8203,12 +8214,13 @@ xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt,
-                               xmlNodePtr cur)
- {
-     if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
-+    if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
-+	(ctxt->context->node->type == XML_NAMESPACE_DECL))
-+	return(NULL);
-     if (cur == NULL) {
-         cur = ctxt->context->node;
-         if (cur == NULL)
-             return (NULL);
--	if (cur->type == XML_NAMESPACE_DECL)
--	    cur = (xmlNodePtr)((xmlNsPtr)cur)->next;
-         ctxt->ancestor = cur->parent;
-     }
-     if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
---
-cgit v0.9.0.2
-
-From ea90b894146030c214a7df6d8375310174f134b9 Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <[email protected]>
-Date: Fri, 22 Oct 2010 13:50:50 +0000
-Subject: Fix a change of semantic on XPath preceding and following axis
-
-This was introduced in the prevous fix, while preceding-sibling and
-following sibling axis are empty for attributes and namespaces,
-preceding and following axis should still work based on the parent
-element. However the parent element is not available for a namespace
-node, so we keep the axis empty in that case.
----
-diff --git a/xpath.c b/xpath.c
-index 9d47618..3352a5e 100644
---- a/xpath.c
-+++ b/xpath.c
[email protected]@ -8106,17 +8106,17 @@ xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- xmlNodePtr
- xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
-     if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
--    if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
--	(ctxt->context->node->type == XML_NAMESPACE_DECL))
--	return(NULL);
--    if (cur != NULL) {
--        if ((cur->type == XML_ATTRIBUTE_NODE) ||
--            (cur->type == XML_NAMESPACE_DECL))
-+    if ((cur != NULL) && (cur->type  != XML_ATTRIBUTE_NODE) &&
-+        (cur->type != XML_NAMESPACE_DECL) && (cur->children != NULL))
-+        return(cur->children);
-+
-+    if (cur == NULL) {
-+        cur = ctxt->context->node;
-+        if (cur->type == XML_NAMESPACE_DECL)
-             return(NULL);
--        if (cur->children != NULL)
--            return cur->children ;
-+        if (cur->type == XML_ATTRIBUTE_NODE)
-+            cur = cur->parent;
-     }
--    if (cur == NULL) cur = ctxt->context->node;
-     if (cur == NULL) return(NULL) ; /* ERROR */
-     if (cur->next != NULL) return(cur->next) ;
-     do {
[email protected]@ -8170,11 +8170,13 @@ xmlNodePtr
- xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
- {
-     if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
--    if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
--	(ctxt->context->node->type == XML_NAMESPACE_DECL))
--	return(NULL);
--    if (cur == NULL)
-+    if (cur == NULL) {
-         cur = ctxt->context->node;
-+        if (cur->type == XML_NAMESPACE_DECL)
-+            return(NULL);
-+        if (cur->type == XML_ATTRIBUTE_NODE)
-+            return(cur->parent);
-+    }
-     if (cur == NULL)
- 	return (NULL);
-     if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
[email protected]@ -8214,13 +8216,12 @@ xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt,
-                               xmlNodePtr cur)
- {
-     if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
--    if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
--	(ctxt->context->node->type == XML_NAMESPACE_DECL))
--	return(NULL);
-     if (cur == NULL) {
-         cur = ctxt->context->node;
-         if (cur == NULL)
-             return (NULL);
-+        if (cur->type == XML_NAMESPACE_DECL)
-+            return (NULL);
-         ctxt->ancestor = cur->parent;
-     }
-     if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
---
-cgit v0.9.0.2
--- a/components/libxml2/patches/18.CVE-2011-3102.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-This patch copied/pasted from this link:
-http://git.gnome.org/browse/libxml2/patch/?id=d8e1faeaa99c7a7c07af01c1c72de352eb590a3e
-----------------------------------------------------------------------
-From d8e1faeaa99c7a7c07af01c1c72de352eb590a3e Mon Sep 17 00:00:00 2001
-From: J├╝ri Aedla <[email protected]>
-Date: Mon, 07 May 2012 07:06:56 +0000
-Subject: Fix an off by one pointer access
-
-getting out of the range of memory allocated for xpointer decoding
----
-diff --git a/xpointer.c b/xpointer.c
-index 37afa3a..0b463dd 100644
---- a/xpointer.c
-+++ b/xpointer.c
[email protected]@ -1007,21 +1007,14 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
- 		NEXT;
- 		break;
- 	    }
--	    *cur++ = CUR;
- 	} else if (CUR == '(') {
- 	    level++;
--	    *cur++ = CUR;
- 	} else if (CUR == '^') {
--	    NEXT;
--	    if ((CUR == ')') || (CUR == '(') || (CUR == '^')) {
--		*cur++ = CUR;
--	    } else {
--		*cur++ = '^';
--		*cur++ = CUR;
--	    }
--	} else {
--	    *cur++ = CUR;
-+            if ((NXT(1) == ')') || (NXT(1) == '(') || (NXT(1) == '^')) {
-+                NEXT;
-+            }
- 	}
-+        *cur++ = CUR;
- 	NEXT;
-     }
-     *cur = 0;
---
-cgit v0.9.0.2
--- a/components/libxml2/patches/19.CVE-2012-0841.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,294 +0,0 @@
-This patch copied/pasted from this link:
-http://git.gnome.org/browse/libxml2/patch/?id=8973d58b7498fa5100a876815476b81fd1a2412a
-----------------------------------------------------------------------
-From 8973d58b7498fa5100a876815476b81fd1a2412a Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <[email protected]>
-Date: Sat, 04 Feb 2012 11:07:44 +0000
-Subject: Add hash randomization to hash and dict structures
-
-Following http://www.ocert.org/advisories/ocert-2011-003.html
-it seems that having hash randomization might be a good idea
-when using XML with untrusted data
-* configure.in: lookup for rand, srand and time
-* dict.c: add randomization to dictionaries hash tables
-* hash.c: add randomization to normal hash tables
----
-diff --git a/configure.in b/configure.in
-index fa80375..828b66a 100644
---- a/configure.in
-+++ b/configure.in
[email protected]@ -512,6 +512,7 @@ AC_CHECK_FUNCS(strdup strndup strerror)
- AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
- AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
- AC_CHECK_FUNCS(stat _stat signal)
-+AC_CHECK_FUNCS(rand srand time)
- 
- dnl Checking the standard string functions availability
- AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
-diff --git a/dict.c b/dict.c
-index 3eff231..ae4966b 100644
---- a/dict.c
-+++ b/dict.c
[email protected]@ -2,7 +2,7 @@
-  * dict.c: dictionary of reusable strings, just used to avoid allocation
-  *         and freeing operations.
-  *
-- * Copyright (C) 2003 Daniel Veillard.
-+ * Copyright (C) 2003-2012 Daniel Veillard.
-  *
-  * Permission to use, copy, modify, and distribute this software for any
-  * purpose with or without fee is hereby granted, provided that the above
[email protected]@ -19,6 +19,28 @@
- #define IN_LIBXML
- #include "libxml.h"
- 
-+#ifdef HAVE_STDLIB_H
-+#include <stdlib.h>
-+#endif
-+#ifdef HAVE_TIME_H
-+#include <time.h>
-+#endif
-+
-+/*
-+ * Following http://www.ocert.org/advisories/ocert-2011-003.html
-+ * it seems that having hash randomization might be a good idea
-+ * when using XML with untrusted data
-+ * Note1: that it works correctly only if compiled with WITH_BIG_KEY
-+ *  which is the default.
-+ * Note2: the fast function used for a small dict won't protect very
-+ *  well but since the attack is based on growing a very big hash
-+ *  list we will use the BigKey algo as soon as the hash size grows
-+ *  over MIN_DICT_SIZE so this actually works
-+ */
-+#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME)
-+#define DICT_RANDOMIZATION
-+#endif
-+
- #include <string.h>
- #ifdef HAVE_STDINT_H
- #include <stdint.h>
[email protected]@ -44,23 +66,23 @@ typedef unsigned __int32 uint32_t;
- #define WITH_BIG_KEY
- 
- #ifdef WITH_BIG_KEY
--#define xmlDictComputeKey(dict, name, len)			\
--    (((dict)->size == MIN_DICT_SIZE) ?				\
--     xmlDictComputeFastKey(name, len) :				\
--     xmlDictComputeBigKey(name, len))
--
--#define xmlDictComputeQKey(dict, prefix, plen, name, len)	\
--    (((prefix) == NULL) ?					\
--      (xmlDictComputeKey(dict, name, len)) :			\
--      (((dict)->size == MIN_DICT_SIZE) ?			\
--       xmlDictComputeFastQKey(prefix, plen, name, len) :	\
--       xmlDictComputeBigQKey(prefix, plen, name, len)))
-+#define xmlDictComputeKey(dict, name, len)                              \
-+    (((dict)->size == MIN_DICT_SIZE) ?                                  \
-+     xmlDictComputeFastKey(name, len, (dict)->seed) :                   \
-+     xmlDictComputeBigKey(name, len, (dict)->seed))
-+
-+#define xmlDictComputeQKey(dict, prefix, plen, name, len)               \
-+    (((prefix) == NULL) ?                                               \
-+      (xmlDictComputeKey(dict, name, len)) :                             \
-+      (((dict)->size == MIN_DICT_SIZE) ?                                \
-+       xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed) :	\
-+       xmlDictComputeBigQKey(prefix, plen, name, len, (dict)->seed)))
- 
- #else /* !WITH_BIG_KEY */
--#define xmlDictComputeKey(dict, name, len)			\
--        xmlDictComputeFastKey(name, len)
--#define xmlDictComputeQKey(dict, prefix, plen, name, len)	\
--        xmlDictComputeFastQKey(prefix, plen, name, len)
-+#define xmlDictComputeKey(dict, name, len)                              \
-+        xmlDictComputeFastKey(name, len, (dict)->seed)
-+#define xmlDictComputeQKey(dict, prefix, plen, name, len)               \
-+        xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed)
- #endif /* WITH_BIG_KEY */
- 
- /*
[email protected]@ -98,6 +120,8 @@ struct _xmlDict {
-     xmlDictStringsPtr strings;
- 
-     struct _xmlDict *subdict;
-+    /* used for randomization */
-+    int seed;
- };
- 
- /*
[email protected]@ -125,6 +149,9 @@ static int xmlInitializeDict(void) {
-     if ((xmlDictMutex = xmlNewRMutex()) == NULL)
-         return(0);
- 
-+#ifdef DICT_RANDOMIZATION
-+    srand(time(NULL));
-+#endif
-     xmlDictInitialized = 1;
-     return(1);
- }
[email protected]@ -277,13 +304,13 @@ found_pool:
-  */
- 
- static uint32_t
--xmlDictComputeBigKey(const xmlChar* data, int namelen) {
-+xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
-     uint32_t hash;
-     int i;
- 
-     if (namelen <= 0 || data == NULL) return(0);
- 
--    hash = 0;
-+    hash = seed;
- 
-     for (i = 0;i < namelen; i++) {
-         hash += data[i];
[email protected]@ -310,12 +337,12 @@ xmlDictComputeBigKey(const xmlChar* data, int namelen) {
-  */
- static unsigned long
- xmlDictComputeBigQKey(const xmlChar *prefix, int plen,
--                      const xmlChar *name, int len)
-+                      const xmlChar *name, int len, int seed)
- {
-     uint32_t hash;
-     int i;
- 
--    hash = 0;
-+    hash = seed;
- 
-     for (i = 0;i < plen; i++) {
-         hash += prefix[i];
[email protected]@ -346,8 +373,8 @@ xmlDictComputeBigQKey(const xmlChar *prefix, int plen,
-  * for low hash table fill.
-  */
- static unsigned long
--xmlDictComputeFastKey(const xmlChar *name, int namelen) {
--    unsigned long value = 0L;
-+xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
-+    unsigned long value = seed;
- 
-     if (name == NULL) return(0);
-     value = *name;
[email protected]@ -381,9 +408,9 @@ xmlDictComputeFastKey(const xmlChar *name, int namelen) {
-  */
- static unsigned long
- xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
--                       const xmlChar *name, int len)
-+                       const xmlChar *name, int len, int seed)
- {
--    unsigned long value = 0L;
-+    unsigned long value = (unsigned long) seed;
- 
-     if (plen == 0)
- 	value += 30 * (unsigned long) ':';
[email protected]@ -460,6 +487,11 @@ xmlDictCreate(void) {
- 	dict->subdict = NULL;
-         if (dict->dict) {
- 	    memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry));
-+#ifdef DICT_RANDOMIZATION
-+            dict->seed = rand();
-+#else
-+            dict->seed = 0;
-+#endif
- 	    return(dict);
-         }
-         xmlFree(dict);
[email protected]@ -486,6 +518,7 @@ xmlDictCreateSub(xmlDictPtr sub) {
- #ifdef DICT_DEBUG_PATTERNS
-         fprintf(stderr, "R");
- #endif
-+        dict->seed = sub->seed;
-         dict->subdict = sub;
- 	xmlDictReference(dict->subdict);
-     }
-diff --git a/hash.c b/hash.c
-index b78bc2d..fe1424f 100644
---- a/hash.c
-+++ b/hash.c
[email protected]@ -3,7 +3,7 @@
-  *
-  * Reference: Your favorite introductory book on algorithms
-  *
-- * Copyright (C) 2000 Bjorn Reese and Daniel Veillard.
-+ * Copyright (C) 2000,2012 Bjorn Reese and Daniel Veillard.
-  *
-  * Permission to use, copy, modify, and distribute this software for any
-  * purpose with or without fee is hereby granted, provided that the above
[email protected]@ -21,6 +21,22 @@
- #include "libxml.h"
- 
- #include <string.h>
-+#ifdef HAVE_STDLIB_H
-+#include <stdlib.h>
-+#endif
-+#ifdef HAVE_TIME_H
-+#include <time.h>
-+#endif
-+
-+/*
-+ * Following http://www.ocert.org/advisories/ocert-2011-003.html
-+ * it seems that having hash randomization might be a good idea
-+ * when using XML with untrusted data
-+ */
-+#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME)
-+#define HASH_RANDOMIZATION
-+#endif
-+
- #include <libxml/parser.h>
- #include <libxml/hash.h>
- #include <libxml/xmlmemory.h>
[email protected]@ -31,6 +47,10 @@
- 
- /* #define DEBUG_GROW */
- 
-+#ifdef HASH_RANDOMIZATION
-+static int hash_initialized = 0;
-+#endif
-+
- /*
-  * A single entry in the hash table
-  */
[email protected]@ -53,6 +73,9 @@ struct _xmlHashTable {
-     int size;
-     int nbElems;
-     xmlDictPtr dict;
-+#ifdef HASH_RANDOMIZATION
-+    int random_seed;
-+#endif
- };
- 
- /*
[email protected]@ -65,6 +88,9 @@ xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
-     unsigned long value = 0L;
-     char ch;
-     
-+#ifdef HASH_RANDOMIZATION
-+    value = table->random_seed;
-+#endif
-     if (name != NULL) {
- 	value += 30 * (*name);
- 	while ((ch = *name++) != 0) {
[email protected]@ -92,6 +118,9 @@ xmlHashComputeQKey(xmlHashTablePtr table,
-     unsigned long value = 0L;
-     char ch;
-     
-+#ifdef HASH_RANDOMIZATION
-+    value = table->random_seed;
-+#endif
-     if (prefix != NULL)
- 	value += 30 * (*prefix);
-     else
[email protected]@ -156,6 +185,13 @@ xmlHashCreate(int size) {
-         table->table = xmlMalloc(size * sizeof(xmlHashEntry));
-         if (table->table) {
-   	    memset(table->table, 0, size * sizeof(xmlHashEntry));
-+#ifdef HASH_RANDOMIZATION
-+            if (!hash_initialized) {
-+                srand(time(NULL));
-+                hash_initialized = 1;
-+            }
-+            table->random_seed = rand();
-+#endif
-   	    return(table);
-         }
-         xmlFree(table);
---
-cgit v0.9.0.2
--- a/components/libxml2/patches/21.runtest.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-From c966790781a9ab5d80aed1246df6316149ef5f07 Mon Sep 17 00:00:00 2001
-From: Rob Richards <[email protected]>
-Date: Fri, 22 Jan 2010 13:24:25 +0000
-Subject: Fix relaxNG tests in runtest for Windows
-
-* runtest.c: initialize ret
----
-(limited to 'runtest.c')
-
-diff --git a/runtest.c b/runtest.c
-index 16196ea..fa925c1 100644
---- a/runtest.c
-+++ b/runtest.c
[email protected]@ -3165,7 +3165,7 @@ rngTest(const char *filename,
-     const char *instance;
-     xmlRelaxNGParserCtxtPtr ctxt;
-     xmlRelaxNGPtr schemas;
--    int res = 0, len, ret;
-+    int res = 0, len, ret = 0;
-     char pattern[500];
-     char prefix[500];
-     char result[500];
---
-cgit v0.9.0.2
--- a/components/libxml2/patches/22.htmlSetMetaEncoding.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-Last file (tree.c) of original commit was left out since it modifies
-just comment where it wouldn't apply because of change in context.
-
-From 39d027cdb74371d64f68dc488556be41e1d14546 Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <[email protected]>
-Date: Fri, 11 May 2012 04:38:23 +0000
-Subject: Fix html serialization error and htmlSetMetaEncoding()
-
-For https://bugzilla.gnome.org/show_bug.cgi?id=630682
-The python tests were reporting errors, some of it was due to
-a small change in case encoding, but the main one was about
-htmlSetMetaEncoding(doc, NULL) being broken by not removing
-the associated meta tag anymore
----
-diff --git a/HTMLtree.c b/HTMLtree.c
-index f23ae02..5d0893b 100644
---- a/HTMLtree.c
-+++ b/HTMLtree.c
[email protected]@ -151,7 +151,7 @@ found_content:
-  * htmlSetMetaEncoding:
-  * @doc:  the document
-  * @encoding:  the encoding string
-- * 
-+ *
-  * Sets the current encoding in the Meta tags
-  * NOTE: this will not change the document content encoding, just
-  * the META flag associated.
[email protected]@ -164,6 +164,7 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
-     const xmlChar *content = NULL;
-     char newcontent[100];
- 
-+    newcontent[0] = 0;
- 
-     if (doc == NULL)
- 	return(-1);
[email protected]@ -244,7 +245,7 @@ found_meta:
- 			    http = 1;
- 			else
-                         {
--                           if ((value != NULL) && 
-+                           if ((value != NULL) &&
-                                (!xmlStrcasecmp(attr->name, BAD_CAST"content")))
- 			       content = value;
-                         }
[email protected]@ -278,8 +279,13 @@ create:
-             xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
-         }
-     } else {
-+        /* remove the meta tag if NULL is passed */
-+        if (encoding == NULL) {
-+            xmlUnlinkNode(meta);
-+            xmlFreeNode(meta);
-+        }
-         /* change the document only if there is a real encoding change */
--        if (xmlStrcasestr(content, encoding) == NULL) {
-+        else if (xmlStrcasestr(content, encoding) == NULL) {
-             xmlSetProp(meta, BAD_CAST"content", BAD_CAST newcontent);
-         }
-     }
-diff --git a/python/tests/serialize.py b/python/tests/serialize.py
-index 5b969a9..91753e7 100755
---- a/python/tests/serialize.py
-+++ b/python/tests/serialize.py
[email protected]@ -96,7 +96,7 @@ str = doc.serialize("iso-8859-1", 1)
- if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
- <html>
- <head>
--<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Hello</title>
- </head>
- <body><p>hello</p></body>
[email protected]@ -131,7 +131,7 @@ if str != """<html>
- str = root.serialize("iso-8859-1", 1)
- if str != """<html>
- <head>
--<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Hello</title>
- </head>
- <body><p>hello</p></body>
---
-cgit v0.9.0.2
--- a/components/libxml2/patches/23.xpathleak.patch	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-Second chunk of the patch was left out since it's already in 2.7.6 even
-according git history it was committed in one step.
-
-From 729601f15772c19778062b98bd0716d8f5c2af3b Mon Sep 17 00:00:00 2001
-From: Martin <[email protected]>
-Date: Mon, 12 Oct 2009 20:42:26 +0000
-Subject: Fix memory leak in xmlXPathEvalExpression()
-
-* xpath.c: plug some leaks when parsing misformed XPath expressions
-* python/tests/xpathleak.py: expand the regression tests for those
----
-(limited to 'python/tests/xpathleak.py')
-
-diff --git a/python/tests/xpathleak.py b/python/tests/xpathleak.py
-index dcc144c..39f49e3 100644
---- a/python/tests/xpathleak.py
-+++ b/python/tests/xpathleak.py
[email protected]@ -15,6 +15,14 @@ expect="""--> Invalid expression
- --> xmlXPathEval: evaluation failed
- --> Invalid expression
- --> xmlXPathEval: evaluation failed
-+--> Invalid expression
-+--> xmlXPathEval: evaluation failed
-+--> Invalid expression
-+--> xmlXPathEval: evaluation failed
-+--> Invalid expression
-+--> xmlXPathEval: evaluation failed
-+--> Invalid expression
-+--> xmlXPathEval: evaluation failed
- """
- err=""
- def callback(ctx, str):
---
-cgit v0.9.0.2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libxml2/patches/PTHREAD_ONCE_INIT.patch	Thu Dec 20 04:53:01 2012 -0800
@@ -0,0 +1,33 @@
+From 3f6cfbd1d38d0634a2ddcb9a0a13e1b5a2195a5e Mon Sep 17 00:00:00 2001
+From: Friedrich Haubensak <[email protected]>
+Date: Wed, 12 Sep 2012 15:34:53 +0000
+Subject: Fix a thread portability problem
+
+cannot compile libxml2-2.9.0 using studio 12.1 compiler on solaris 10
+
+I.M.O. structure initializer (as PTHREAD_ONCE_INIT) cannot be used in
+a structure assignment anyway
+---
+diff --git a/threads.c b/threads.c
+index f206149..7e85a26 100644
+--- a/threads.c
++++ b/threads.c
[email protected]@ -146,6 +146,7 @@ struct _xmlRMutex {
+ static pthread_key_t globalkey;
+ static pthread_t mainthread;
+ static pthread_once_t once_control = PTHREAD_ONCE_INIT;
++static pthread_once_t once_control_init = PTHREAD_ONCE_INIT;
+ static pthread_mutex_t global_init_lock = PTHREAD_MUTEX_INITIALIZER;
+ #elif defined HAVE_WIN32_THREADS
+ #if defined(HAVE_COMPILER_TLS)
[email protected]@ -915,7 +916,7 @@ xmlCleanupThreads(void)
+ #ifdef HAVE_PTHREAD_H
+     if ((libxml_is_threaded)  && (pthread_key_delete != NULL))
+         pthread_key_delete(globalkey);
+-    once_control = PTHREAD_ONCE_INIT;
++    once_control = once_control_init;
+ #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
+     if (globalkey != TLS_OUT_OF_INDEXES) {
+         xmlGlobalStateCleanupHelperParams *p;
+--
+cgit v0.9.0.2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libxml2/patches/bug684774.patch	Thu Dec 20 04:53:01 2012 -0800
@@ -0,0 +1,52 @@
+See:
+
+http://git.gnome.org/browse/libxml2/commit/?id=6c91aa384f48ff6d406553a6dd47fd556c1ef2e6
+
+From 6c91aa384f48ff6d406553a6dd47fd556c1ef2e6 Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <[email protected]>
+Date: Thu, 25 Oct 2012 07:33:59 +0000
+Subject: Fix a regression in 2.9.0 breaking validation while streaming
+
+https://bugzilla.gnome.org/show_bug.cgi?id=684774
+with help from Kjell Ahlstedt <[email protected]>
+---
+diff --git a/SAX2.c b/SAX2.c
+index a24abc8..3eea39a 100644
+--- a/SAX2.c
++++ b/SAX2.c
[email protected]@ -2202,7 +2202,7 @@ xmlSAX2StartElementNs(void *ctx,
+ 	  (ctxt->myDoc->intSubset->elements == NULL) &&
+ 	  (ctxt->myDoc->intSubset->attributes == NULL) &&
+ 	  (ctxt->myDoc->intSubset->entities == NULL)))) {
+-	xmlErrValid(ctxt, XML_ERR_NO_DTD,
++	xmlErrValid(ctxt, XML_DTD_NO_DTD,
+ 	  "Validation failed: no DTD found !", NULL, NULL);
+ 	ctxt->validate = 0;
+     }
+diff --git a/parser.c b/parser.c
+index 28b0d80..19f1217 100644
+--- a/parser.c
++++ b/parser.c
[email protected]@ -11633,7 +11633,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
+ 			    "PP: Parsing internal subset\n");
+ #endif
+ 		    ctxt->inSubset = 1;
+-                    ctxt->progressive = 1;
++                    ctxt->progressive = 0;
+ 		    ctxt->checkIndex = 0;
+ 		    xmlParseDocTypeDecl(ctxt);
+ 		    if (RAW == '[') {
[email protected]@ -12219,7 +12219,10 @@ xmldecl_done:
+ 	}
+ 	ctxt->instate = XML_PARSER_EOF;
+     }
+-    return((xmlParserErrors) ctxt->errNo);
++    if (ctxt->wellFormed == 0)
++	return((xmlParserErrors) ctxt->errNo);
++    else
++        return(0);
+ }
+ 
+ /************************************************************************
+--
+cgit v0.9.0.2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libxml2/patches/man.patch	Thu Dec 20 04:53:01 2012 -0800
@@ -0,0 +1,80 @@
+--- libxml2-2.9.0/libxml.3	Mon Sep 10 20:52:46 2012
++++ libxml2-2.9.0/libxml.3	Fri Oct 26 02:09:19 2012
[email protected]@ -49,14 +49,14 @@
+ .IR html . 
+ .SH FILES
+ .TP 2.2i
+-.B /depot/lib/libxml_2.0.0/libxml.a
+-static library
+-.TP
+-.B /depot/lib/libxml_2.0.0/libxml.so
++.B /lib/libxml2.so
+ shared library
+ .TP
+-.B /depot/package/libxml_2.0.0/bin/xmllint
++.B /usr/bin/xmllint
+ binary application for parsing XML files
++.TP
++.B /usr/bin/xml2-config
++application for printing library configuration
+ .SH AUTHORS
+ Daniel Veillard ([email protected]).
+ Red Hat Inc.
+--- libxml2-2.9.0/doc/xmlcatalog.1	Mon Sep 10 20:52:46 2012
++++ libxml2-2.9.0/doc/xmlcatalog.1	Fri Oct 26 01:51:09 2012
[email protected]@ -7,7 +7,7 @@
+ .\"    Source: libxml2
+ .\"  Language: English
+ .\"
+-.TH "XMLCATALOG" "1" "$Date$" "libxml2" "xmlcatalog Manual"
++.TH "XMLCATALOG" "1" "11 Sep 2012" "libxml2" "xmlcatalog Manual"
+ .\" -----------------------------------------------------------------
+ .\" * Define some portability stuff
+ .\" -----------------------------------------------------------------
[email protected]@ -284,7 +284,7 @@
+ .\}
+ \fBlibxml\fR(3)
+ web page
+-\m[blue]\fB\%http://www.xmlsoft.org/\fR\m[]
++\fB\%http://www.xmlsoft.org/\fR
+ .RE
+ .sp
+ .RS 4
[email protected]@ -297,7 +297,7 @@
+ .\}
+ \fBlibxml\fR(3)
+ catalog support web page at
+-\m[blue]\fB\%http://www.xmlsoft.org/catalog.html\fR\m[]
++\fB\%http://www.xmlsoft.org/catalog.html\fR
+ .RE
+ .sp
+ .RS 4
[email protected]@ -311,7 +311,7 @@
+ James Clark\*(Aqs
+ SGML
+ catalog page
+-\m[blue]\fB\%http://www.jclark.com/sp/catalog.htm\fR\m[]
++\fB\%http://www.jclark.com/sp/catalog.htm\fR
+ .RE
+ .sp
+ .RS 4
[email protected]@ -325,7 +325,7 @@
+ OASIS
+ XML
+ catalog specification
+-\m[blue]\fB\%http://www.oasis-open.org/committees/entity/spec.html\fR\m[]
++\fB\%http://www.oasis-open.org/committees/entity/spec.html\fR
+ .RE
+ .sp
+ .SH "AUTHOR"
+--- libxml2-2.9.0/doc/xmllint.1	Wed Sep  5 04:14:55 2012
++++ libxml2-2.9.0/doc/xmllint.1	Fri Oct 26 01:56:00 2012
[email protected]@ -2,7 +2,7 @@
+ .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
+ .\" Instead of manually editing it, you probably should edit the DocBook XML
+ .\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
+-.TH "XMLLINT" "1" "$Date$" "libxml2" ""
++.TH "XMLLINT" "1" "11 Sep 2012" "libxml2" ""
+ .\" disable hyphenation
+ .nh
+ .\" disable justification (adjust text to left margin only)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libxml2/patches/mapfile.patch	Thu Dec 20 04:53:01 2012 -0800
@@ -0,0 +1,25 @@
+See:
+
+https://mail.gnome.org/archives/xml/2012-October/msg00038.html
+https://mail.gnome.org/archives/xml/2012-October/msg00039.html
+
+--- libxml2-2.9.0/configure.in	Mon Sep 10 20:52:46 2012
++++ libxml2-2.9.0/configure.in	Fri Oct 26 08:16:02 2012
[email protected]@ -82,7 +82,7 @@
+   VERSION_SCRIPT_FLAGS=-Wl,--version-script=
+ else
+   case $host in
+-  *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
++  *-*-solaris*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
+   esac
+ fi
+ AC_SUBST(VERSION_SCRIPT_FLAGS)
[email protected]@ -1149,7 +1153,7 @@
+     TEST_SAX=SAXtests
+ fi
+ AC_SUBST(WITH_SAX1)
+-AM_CONDITIONAL(WITH_SAX1_SOURCES, test "${WITH_TRIO}" = "1")
++AM_CONDITIONAL(WITH_SAX1_SOURCES, test "${WITH_SAX1}" = "1")
+ AC_SUBST(TEST_SAX)
+ 
+ if test "$with_push" = "no" ; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libxml2/patches/test_errors_name2.patch	Thu Dec 20 04:53:01 2012 -0800
@@ -0,0 +1,10 @@
+We need to avoid test/errors/name2.xml test to avoid false positive
+noise. For more info see:
+
+https://mail.gnome.org/archives/xml/2012-November/msg00006.html
+https://mail.gnome.org/archives/xml/2012-September/msg00038.html
+
+--- libxml2-2.9.0/test/errors/name2.xml	2009-07-30 08:24:34.000000000 -0700
++++ /dev/null	2012-11-06 02:29:41.000000000 -0800
[email protected]@ -1 +0,0 @@
+-<foo foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
--- a/components/libxml2/xml2-config.1	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-.TH xml2-config 1 "3 July 1999"
-.SH NAME
-xml2-config - script to get information about the installed version of libxml
-.SH SYNOPSIS
-.B xml2-config
-[\-\-prefix\fI[=DIR]\fP] [\-\-libs] [\-\-cflags] [\-\-version] [\-\-help]
-.SH DESCRIPTION
-\fIxml2-config\fP is a tool that is used to determine the compile and
-linker flags that should be used to compile and link programs that use
-\fIlibxml\fP.
-.SH OPTIONS
-.l
-\fIxml2-config\fP accepts the following options:
-.TP 8
-.B  \-\-version
-Print the currently installed version of \fIlibxml\fP on the standard output.
-.TP 8
-.B  \-\-libs
-Print the linker flags that are necessary to link a \fIlibxml\fP program.
-.TP 8
-.B  \-\-cflags
-Print the compiler flags that are necessary to compile a \fIlibxml\fP program.
-.TP 8
-.B  \-\-prefix=PREFIX
-If specified, use PREFIX instead of the installation prefix that
-\fIlibxml\fP was built with when computing the output for the
-\-\-cflags and \-\-libs options. This option must be specified before
-any \-\-libs or \-\-cflags options.
-.SH AUTHOR
-This manual page was written by Fredrik Hallenberg <[email protected]>,
-for the Debian GNU/linux system (but may be used by others).
-.SH NOTES
-Source for libxml is available on http://opensolaris.org.
-Documentation for libxml is available on-line at http://www.xmlsoft.org/
--- a/components/libxml2/xmlcatalog.1	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-.TH xmlcatalog 1 "Nov 26 2001"
-.SH NAME
-xmlcatalog \- Command line tool to parse and manipulate XML or SGML catalog files.
-.SH "SYNOPSIS"
-\fBxmlcatalog\fR [\fB--shell\fR | \fB--create\fR | \fB--add  \fItype\fR 
-	   \fIorig\fR   \fIreplace\fR \fR | \fB--del  \fIvalues\fR \fR | \fB--noout\fR | \fB--verbose\fR] [\fB\fIcatalogfile\fR\fR] [\fB\fIentities\fR\fR]
-.SH "INTRODUCTION"
-
-.PP
-xmlcatalog is a command line application allowing users to monitor and manipulate XML and SGML catalogs. It is included in libxml2.
-.PP
-Its functions can be invoked from a single command from the command line, or it can perform multiple functions in interactive mode. It can operate on both XML and SGML files.
-.SH "COMMAND LINE OPTIONS"
-
-.TP
-\fB--shell\fR \fIfilename\fR
-Run a shell allowing interactive queries on catalog file \fIfilename\fR.
-.TP
-\fB--create\fR \fIfilename\fR
-Create a new XML catalog. Outputs to stdout, ignoring \fIfilename\fR unless \fB--noout\fR is used, in which case it creates a new catalog file \fIfilename\fR.
-.TP
-\fB--add\fR \fI'type'\fR \fI'orig'\fR \fI'replace'\fR \fIfilename\fR
-Add an entry to catalog file \fIfilename\fR. \fItype\fR indicates the type of entry. Possible types are 'public', 'system', 'rewriteSystem', 'delegatePublic' and 'delegateSystem'. \fI'orig'\fR is the original reference to be replaced, and \fI'replace'\fR is the URI of the replacement entity to be used. The \fB--add\fR option will not overwrite \fIfilename\fR, outputing to stdout, unless \fB--noout\fR is used. The \fB--add\fR will always take three parameters even if some of the XML catalog constructs will have only a single argument.
-
-If the \fB--add\fR option is used following the \fB--sgml\fR option, only a single argument, a \fIfilename\fR, is used. This is used to add the name of a catalog file to an SGML supercatalog, a file that contains references to other included SGML catalog files.
-.TP
-\fB--del\fR \fI'values'\fR \fIfilename\fR
-Remove entries from the catalog file \fIfilename\fR matching \fI'values'\fR. The \fB--del\fR option will not overwrite \fIfilename\fR, outputing to stdout, unless \fB--noout\fR is used.
-.TP
-\fB--noout\fR
-Save output to the named file rather than outputing to stdout.
-.TP
-\fB-v\fR or \fB--verbose\fR
-Output debugging information.
-.SH "SHELL COMMANDS"
-.PP
-Invoking xmlcatalog with the \fB--shell\fR \fIfilename\fR option opens a command line shell allowing interactive access to the catalog file identified by \fIfilename\fR. Invoking the shell provides a command line prompt after which commands can be entered.
-.TP
-\fBpublic\fR \fI'PublicID'\fR
-Execute a public identifier lookup of the catalog entry for \fI'PublicID'\fR. The corresponding entry will be output to the command line.
-.TP
-\fBsystem\fR \fI'SystemID'\fR
-Execute a public identifier lookup of the catalog entry for \fI'SystemID'\fR. The corresponding entry will be output to the command line.
-.TP
-\fBadd \fR \fI'type'\fR \fI'orig'\fR \fI'replace'\fR
-Add an entry to the catalog file. \fItype\fR indicates the type of entry. Possible types are 'public', 'system', 'rewriteSystem', 'delegatePublic' and 'delegateSystem'. \fI'orig'\fR is the original reference to be replaced, and \fI'replace'\fR is the URI of the replacement entity to be used.
-.TP
-\fBdel\fR \fI'values'\fR
-Remove the catalog entry corresponding to \fI'values'\fR.
-.TP
-\fBdump\fR
-Print the current catalog.
-.TP
-\fBdebug\fR
-Print debugging statements showing the steps xmlcatalog is executing.
-.TP
-\fBquiet\fR
-Stop printing debugging statements.
-.TP
-\fBexit\fR
-Quit the shell.
-.SH "REFERENCES"
-
-.TP
-libxml web page:
-http://www.xmlsoft.org/
-.TP
-libxml catalog support web page:
-http://www.xmlsoft.org/catalog.html
-.TP
-James Clark's SGML catalog page:
-http://www.jclark.com/sp/catalog.htm
-.TP
-OASIS XML catalog specification:
-http://www.oasis-open.org/committees/entity/spec.html
-
-.SH AUTHOR
-John Fleck  <[email protected]>
-This is release 0.2 of the xmlcatalog Manual.
-
--- a/components/libxml2/xmllint.1	Wed Dec 19 02:21:27 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-.TH xmllint 1 "2001 Nov 26"
-.SH NAME
-xmllint \- command line XML tool
-.SH "SYNOPSIS"
-\fBxmllint\fR [\fB--version\fR | \fB--debug\fR | \fB--shell\fR | \fB--debugent\fR | \fB--copy\fR | \fB--recover\fR | \fB--noent\fR | \fB--noout\fR | \fB--htmlout\fR | \fB--nowrap\fR | \fB--valid\fR | \fB--postvalid\fR | \fB--dtdvalid  \fIURL\fR \fR | \fB--timing\fR | \fB--repeat\fR | \fB--insert\fR | \fB--compress\fR | \fB--sgml\fR | \fB--html\fR | \fB--push\fR | \fB--memory\fR | \fB--nowarning\fR | \fB--noblanks\fR | \fB--format\fR | \fB--testIO\fR | \fB--encode  \fIencoding\fR \fR | \fB--catalogs\fR | \fB--nocatalogs\fR | \fB--auto\fR | \fB--xinclude\fR | \fB--loaddtd\fR | \fB--dtdattr\fR | \fB--dropdtd\fR] [\fB\fIxmlfile\fR\fR]
-.SH "INTRODUCTION"
-
-.PP
-The xmllint program parses one or more XML files, specified on the command line as \fIxmlfile\fR. It prints various types of output, depending upon the options selected. It is useful for detecting errors both in XML code and in the XML parser itself.
-.PP
-It is included in libxml2.
-.SH "OPTIONS"
-
-.TP
-\fB--version\fR
-Display the version of libxml2 used.
-.TP
-\fB--debug\fR
-Parse a file and output an annotated tree of the in-memory version of the document.
-.TP
-\fB--shell\fR
-Run a navigating shell.
-.TP
-\fB--debugent\fR
-Debug the entities defined in the document.
-.TP
-\fB--copy\fR 
-Test the internal copy implementation.
-.TP
-\fB--recover\fR
-Output any parsable portions of an invalid document.
-.TP
-\fB--noent\fR
-Substitute entity values for entity references. By default, xmllint leaves entity references in place.
-.TP
-\fB--noout\fR
-Suppress output. By default, xmllint outputs the result tree.
-.TP
-\fB--htmlout\fR
-Output results as an HTML file. This causes xmllint to output the necessary HTML tags surrounding the result tree output so the results can be displayed in a browser.
-.TP
-\fB--nowrap \fR
-Do not output HTML doc wrapper.
-.TP
-\fB--valid \fR
-Determine if the document is a valid instance of the included Document Type Definition (DTD). A DTD to be validated against also can be specified at the command line using the \fB--dtdvalid\fR option. By default, xmllint also checks to determine if the document is well-formed.
-.TP
-\fB--postvalid\fR
-Validate after parsing is completed.
-.TP
- \fB--dtdvalid\fR \fIURL\fR
-Use the DTD specified by \fIURL\fR for validation.
-.TP
-\fB--timing\fR
-Output information about the time it takes xmllint to perform the various steps.
-.TP
-\fB--repeat\fR
-Repeat 100 times, for timing or profiling.
-.TP
-\fB--insert\fR
-Test for valid insertions.
-.TP
-\fB--compress\fR
-Turn on gzip compression of output.
-.TP
-\fB--sgml\fR
-Use the DocBook SGML parser. This allows documents written in SGML DocBook to be converted into an in-memory tree and treated as if they were written in XML.
-.TP
-\fB--html\fR
-Use the HTML parser.
-.TP
-\fB--push\fR
-Use the push mode of the parser.
-.TP
-\fB--memory\fR
-Parse from memory.
-.TP
-\fB--nowarning\fR
-Do not emit warnings from the parser and/or validator.
-.TP
-\fB--noblanks\fR
-Drop ignorable blank spaces.
-.TP
-\fB--format\fR
-Reformat and reindent the output.
-.TP
-\fB--testIO\fR
-Test user input/output support.
-.TP
-\fB--encode\fR \fIencoding\fR
-Output in the given encoding.
-.TP
-\fB--catalogs\fR
-Use the catalogs from $SGML_CATALOG_FILES. Otherwise /etc/xml/catalog is used by default.
-.TP
-\fB--nocatalogs\fR
-Do not use any catalogs.
-.TP
-\fB--auto\fR
-Generate a small document for testing purposes.
-.TP
-\fB--xinclude\fR
-Do XInclude processing.
-.TP
-\fB--loaddtd\fR
-Fetch external DTD.
-.TP
-\fB--dtdattr\fR
-Fetch external DTD and populate the tree with inherited attributes.
-.TP
-\fB--dropdtd\fR
-Remove DTD from output.
-.SH AUTHORS
-John Fleck <[email protected]>, Ziying Sherwin <[email protected]>, Heiko Rupp <[email protected]>
-This is release 0.2 of the xmllint Manual.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/php-5_2/php-sapi/patches/13_php_libxml_2_9_0.patch	Thu Dec 20 04:53:01 2012 -0800
@@ -0,0 +1,58 @@
+Update to work with libxml 2.9.0 
+
+https://github.com/php/php-src/commit/c4b26cc1b0b0521c75e653fffec2a9e3b4bf8cbb
+
+diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
+index d61ba79..eee3b5f 100644
+--- a/ext/dom/documenttype.c
++++ b/ext/dom/documenttype.c
[email protected]@ -205,7 +205,11 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_
+ 		if (buff != NULL) {
+ 			xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
+ 			xmlOutputBufferFlush(buff);
++#ifdef LIBXML2_NEW_BUFFER
++			ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1);
++#else
+ 			ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
++#endif
+ 			(void)xmlOutputBufferClose(buff);
+ 			return SUCCESS;
+ 		}
+diff --git a/ext/dom/node.c b/ext/dom/node.c
+index 5bcb234..727d1bc 100644
+--- a/ext/dom/node.c
++++ b/ext/dom/node.c
[email protected]@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
+         RETVAL_FALSE;
+     } else {
+ 		if (mode == 0) {
++#ifdef LIBXML2_NEW_BUFFER
++			ret = xmlOutputBufferGetSize(buf);
++#else
+ 			ret = buf->buffer->use;
++#endif
+ 			if (ret > 0) {
++#ifdef LIBXML2_NEW_BUFFER
++				RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);
++#else
+ 				RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
++#endif
+ 			} else {
+ 				RETVAL_EMPTY_STRING();
+ 			}
+diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
+index a379111..2368596 100644
+--- a/ext/simplexml/simplexml.c
++++ b/ext/simplexml/simplexml.c
[email protected]@ -1387,7 +1387,11 @@ static int sxe_objects_compare(zval *object1, zval *object2 TSRMLS_DC) /* {{{ */
+ 
+ 			xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
+ 			xmlOutputBufferFlush(outbuf);
++#ifdef LIBXML2_NEW_BUFFER
++			RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf), xmlOutputBufferGetSize(outbuf), 1);
++#else
+ 			RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
++#endif
+ 			xmlOutputBufferClose(outbuf);
+ 		}
+ 	} else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/php-5_3/php-sapi/patches/134_php_libxml_2_9_0.patch	Thu Dec 20 04:53:01 2012 -0800
@@ -0,0 +1,58 @@
+Update to work with libxml 2.9.0 
+
+https://github.com/php/php-src/commit/c4b26cc1b0b0521c75e653fffec2a9e3b4bf8cbb
+
+diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
+index d61ba79..eee3b5f 100644
+--- a/ext/dom/documenttype.c
++++ b/ext/dom/documenttype.c
[email protected]@ -205,7 +205,11 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_
+ 		if (buff != NULL) {
+ 			xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
+ 			xmlOutputBufferFlush(buff);
++#ifdef LIBXML2_NEW_BUFFER
++			ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1);
++#else
+ 			ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
++#endif
+ 			(void)xmlOutputBufferClose(buff);
+ 			return SUCCESS;
+ 		}
+diff --git a/ext/dom/node.c b/ext/dom/node.c
+index 5bcb234..727d1bc 100644
+--- a/ext/dom/node.c
++++ b/ext/dom/node.c
[email protected]@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
+         RETVAL_FALSE;
+     } else {
+ 		if (mode == 0) {
++#ifdef LIBXML2_NEW_BUFFER
++			ret = xmlOutputBufferGetSize(buf);
++#else
+ 			ret = buf->buffer->use;
++#endif
+ 			if (ret > 0) {
++#ifdef LIBXML2_NEW_BUFFER
++				RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);
++#else
+ 				RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
++#endif
+ 			} else {
+ 				RETVAL_EMPTY_STRING();
+ 			}
+diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
+index a379111..2368596 100644
+--- a/ext/simplexml/simplexml.c
++++ b/ext/simplexml/simplexml.c
[email protected]@ -1387,7 +1387,11 @@ static int sxe_objects_compare(zval *object1, zval *object2 TSRMLS_DC) /* {{{ */
+ 
+ 			xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
+ 			xmlOutputBufferFlush(outbuf);
++#ifdef LIBXML2_NEW_BUFFER
++			RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf), xmlOutputBufferGetSize(outbuf), 1);
++#else
+ 			RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
++#endif
+ 			xmlOutputBufferClose(outbuf);
+ 		}
+ 	} else {