Blame SOURCES/libxml2-Fix-regression-introduced-by-CVE-2014-0191.patch

6dedca
commit 41b0d17368565b56677455be61b2c892bd665a27
6dedca
Author: Daniel Veillard <veillard@redhat.com>
6dedca
Date:   Wed Jun 11 16:54:32 2014 +0800
6dedca
6dedca
    Fix regressions introduced by CVE-2014-0191 patch
6dedca
    
6dedca
    A number of issues have been raised after the fix, and this patch
6dedca
    tries to correct all of them, though most were related to
6dedca
    postvalidation.
6dedca
    https://bugzilla.gnome.org/show_bug.cgi?id=730290
6dedca
    and other reports on list, off-list and on Red Hat bugzilla
6dedca
6dedca
diff --git a/parser.c b/parser.c
6dedca
index 32f1475..b58c2f0 100644
6dedca
--- a/parser.c
6dedca
+++ b/parser.c
6dedca
@@ -2622,8 +2622,8 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
6dedca
 		    xmlCharEncoding enc;
6dedca
 
6dedca
 		    /*
6dedca
-		     * Note: external parsed entities will not be loaded, it is
6dedca
-		     * not required for a non-validating parser, unless the
6dedca
+		     * Note: external parameter entities will not be loaded, it
6dedca
+		     * is not required for a non-validating parser, unless the
6dedca
 		     * option of validating, or substituting entities were
6dedca
 		     * given. Doing so is far more secure as the parser will
6dedca
 		     * only process data coming from the document entity by
6dedca
@@ -2632,6 +2632,9 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
6dedca
                     if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
6dedca
 		        ((ctxt->options & XML_PARSE_NOENT) == 0) &&
6dedca
 			((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
6dedca
+			((ctxt->options & XML_PARSE_DTDLOAD) == 0) &&
6dedca
+			((ctxt->options & XML_PARSE_DTDATTR) == 0) &&
6dedca
+			(ctxt->replaceEntities == 0) &&
6dedca
 			(ctxt->validate == 0))
6dedca
 			return;
6dedca
 
6dedca
@@ -12643,6 +12646,9 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
6dedca
 	return(NULL);
6dedca
     }
6dedca
 
6dedca
+    /* We are loading a DTD */
6dedca
+    ctxt->options |= XML_PARSE_DTDLOAD;
6dedca
+
6dedca
     /*
6dedca
      * Set-up the SAX context
6dedca
      */
6dedca
@@ -12770,6 +12776,9 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
6dedca
 	return(NULL);
6dedca
     }
6dedca
 
6dedca
+    /* We are loading a DTD */
6dedca
+    ctxt->options |= XML_PARSE_DTDLOAD;
6dedca
+
6dedca
     /*
6dedca
      * Set-up the SAX context
6dedca
      */