xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

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

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