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

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

ff4713
      *