Blame SOURCES/xerces-j2-CVE-2013-4002.patch

a2c4e5
--- src/org/apache/xerces/impl/XMLScanner.java	2013/07/03 18:25:06	1499505
a2c4e5
+++ src/org/apache/xerces/impl/XMLScanner.java	2013/07/03 18:29:43	1499506
a2c4e5
@@ -542,7 +542,7 @@
a2c4e5
         // document is until we scan the encoding declaration
a2c4e5
         // you cannot reliably read any characters outside
a2c4e5
         // of the ASCII range here. -- mrglavas
a2c4e5
-        String name = fEntityScanner.scanName();
a2c4e5
+        String name = scanPseudoAttributeName();
a2c4e5
         XMLEntityManager.print(fEntityManager.getCurrentEntity());
a2c4e5
         if (name == null) {
a2c4e5
             reportFatalError("PseudoAttrNameExpected", null);
a2c4e5
@@ -599,6 +599,35 @@
a2c4e5
     } // scanPseudoAttribute(XMLString):String
a2c4e5
     
a2c4e5
     /**
a2c4e5
+     * Scans the name of a pseudo attribute. The only legal names
a2c4e5
+     * in XML 1.0/1.1 documents are 'version', 'encoding' and 'standalone'.
a2c4e5
+     * 
a2c4e5
+     * @return the name of the pseudo attribute or null
a2c4e5
+     * if a legal pseudo attribute name could not be scanned.
a2c4e5
+     */
a2c4e5
+    private String scanPseudoAttributeName() throws IOException, XNIException {
a2c4e5
+        final int ch = fEntityScanner.peekChar();
a2c4e5
+        switch (ch) {
a2c4e5
+            case 'v':
a2c4e5
+                if (fEntityScanner.skipString(fVersionSymbol)) {
a2c4e5
+                    return fVersionSymbol;
a2c4e5
+                }
a2c4e5
+                break;
a2c4e5
+            case 'e':
a2c4e5
+                if (fEntityScanner.skipString(fEncodingSymbol)) {
a2c4e5
+                    return fEncodingSymbol;
a2c4e5
+                }
a2c4e5
+                break;
a2c4e5
+            case 's':
a2c4e5
+                if (fEntityScanner.skipString(fStandaloneSymbol)) {
a2c4e5
+                    return fStandaloneSymbol;
a2c4e5
+                }
a2c4e5
+                break;
a2c4e5
+        }
a2c4e5
+        return null;
a2c4e5
+    } // scanPseudoAttributeName()
a2c4e5
+    
a2c4e5
+    /**
a2c4e5
      * Scans a processing instruction.
a2c4e5
      * 

a2c4e5
      *