view patches/openjdk/p11cipher-6867345-turkish_regional_options_cause_npe_in_algoid.patch @ 3231:6ddafe528889

Update to build against October 2015 security fixes. 2015-10-27 Andrew John Hughes <gnu.andrew@redhat.com> * Makefile.am: (OPENJDK_DATE): Bump to b37 creation date; 27th of October, 2015. (OPENJDK_SHA256SUM): Update for b37 tarball. 2015-10-26 Andrew John Hughes <gnu.andrew@redhat.com> * NEWS: Updated. * generated/java/nio/BufferOverflowException.java, * generated/java/nio/BufferUnderflowException.java, * generated/java/nio/ByteBuffer.java, * generated/java/nio/ByteBufferAsCharBufferB.java, * generated/java/nio/ByteBufferAsCharBufferL.java, * generated/java/nio/ByteBufferAsCharBufferRB.java, * generated/java/nio/ByteBufferAsCharBufferRL.java, * generated/java/nio/ByteBufferAsDoubleBufferB.java, * generated/java/nio/ByteBufferAsDoubleBufferL.java, * generated/java/nio/ByteBufferAsDoubleBufferRB.java, * generated/java/nio/ByteBufferAsDoubleBufferRL.java, * generated/java/nio/ByteBufferAsFloatBufferB.java, * generated/java/nio/ByteBufferAsFloatBufferL.java, * generated/java/nio/ByteBufferAsFloatBufferRB.java, * generated/java/nio/ByteBufferAsFloatBufferRL.java, * generated/java/nio/ByteBufferAsIntBufferB.java, * generated/java/nio/ByteBufferAsIntBufferL.java, * generated/java/nio/ByteBufferAsIntBufferRB.java, * generated/java/nio/ByteBufferAsIntBufferRL.java, * generated/java/nio/ByteBufferAsLongBufferB.java, * generated/java/nio/ByteBufferAsLongBufferL.java, * generated/java/nio/ByteBufferAsLongBufferRB.java, * generated/java/nio/ByteBufferAsLongBufferRL.java, * generated/java/nio/ByteBufferAsShortBufferB.java, * generated/java/nio/ByteBufferAsShortBufferL.java, * generated/java/nio/ByteBufferAsShortBufferRB.java, * generated/java/nio/ByteBufferAsShortBufferRL.java, * generated/java/nio/CharBuffer.java, * generated/java/nio/DirectByteBuffer.java, * generated/java/nio/DirectByteBufferR.java, * generated/java/nio/DirectCharBufferRS.java, * generated/java/nio/DirectCharBufferRU.java, * generated/java/nio/DirectCharBufferS.java, * generated/java/nio/DirectCharBufferU.java, * generated/java/nio/DirectDoubleBufferRS.java, * generated/java/nio/DirectDoubleBufferRU.java, * generated/java/nio/DirectDoubleBufferS.java, * generated/java/nio/DirectDoubleBufferU.java, * generated/java/nio/DirectFloatBufferRS.java, * generated/java/nio/DirectFloatBufferRU.java, * generated/java/nio/DirectFloatBufferS.java, * generated/java/nio/DirectFloatBufferU.java, * generated/java/nio/DirectIntBufferRS.java, * generated/java/nio/DirectIntBufferRU.java, * generated/java/nio/DirectIntBufferS.java, * generated/java/nio/DirectIntBufferU.java, * generated/java/nio/DirectLongBufferRS.java, * generated/java/nio/DirectLongBufferRU.java, * generated/java/nio/DirectLongBufferS.java, * generated/java/nio/DirectLongBufferU.java, * generated/java/nio/DirectShortBufferRS.java, * generated/java/nio/DirectShortBufferRU.java, * generated/java/nio/DirectShortBufferS.java, * generated/java/nio/DirectShortBufferU.java, * generated/java/nio/DoubleBuffer.java, * generated/java/nio/FloatBuffer.java, * generated/java/nio/HeapByteBuffer.java, * generated/java/nio/HeapByteBufferR.java, * generated/java/nio/HeapCharBuffer.java, * generated/java/nio/HeapCharBufferR.java, * generated/java/nio/HeapDoubleBuffer.java, * generated/java/nio/HeapDoubleBufferR.java, * generated/java/nio/HeapFloatBuffer.java, * generated/java/nio/HeapFloatBufferR.java, * generated/java/nio/HeapIntBuffer.java, * generated/java/nio/HeapIntBufferR.java, * generated/java/nio/HeapLongBuffer.java, * generated/java/nio/HeapLongBufferR.java, * generated/java/nio/HeapShortBuffer.java, * generated/java/nio/HeapShortBufferR.java, * generated/java/nio/IntBuffer.java, * generated/java/nio/InvalidMarkException.java, * generated/java/nio/LongBuffer.java, * generated/java/nio/ReadOnlyBufferException.java, * generated/java/nio/ShortBuffer.java, * generated/java/nio/channels/AlreadyConnectedException.java, * generated/java/nio/channels/AsynchronousCloseException.java, * generated/java/nio/channels/CancelledKeyException.java, * generated/java/nio/channels/ClosedByInterruptException.java, * generated/java/nio/channels/ClosedChannelException.java, * generated/java/nio/channels/ClosedSelectorException.java, * generated/java/nio/channels/ConnectionPendingException.java, * generated/java/nio/channels/FileLockInterruptionException.java, * generated/java/nio/channels/IllegalBlockingModeException.java, * generated/java/nio/channels/IllegalSelectorException.java, * generated/java/nio/channels/NoConnectionPendingException.java, * generated/java/nio/channels/NonReadableChannelException.java, * generated/java/nio/channels/NonWritableChannelException.java, * generated/java/nio/channels/NotYetBoundException.java, * generated/java/nio/channels/NotYetConnectedException.java, * generated/java/nio/channels/OverlappingFileLockException.java, * generated/java/nio/channels/UnresolvedAddressException.java, * generated/java/nio/channels/UnsupportedAddressTypeException.java, * generated/java/nio/charset/CharacterCodingException.java, * generated/java/nio/charset/CharsetDecoder.java, * generated/java/nio/charset/CharsetEncoder.java, * generated/java/nio/charset/IllegalCharsetNameException.java, * generated/java/nio/charset/UnsupportedCharsetException.java: Replaced by versions from a build of OpenJDK 6 b37. * patches/openjdk/p11cipher-6867345-turkish_regional_options_cause_npe_in_algoid.patch: Regenerated. * patches/version.patch: Fix path from Version-template.java to Version.java.template, following 6888701 upstream.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Tue, 27 Oct 2015 16:35:07 +0000
parents 6ae19889a9e0
children
line wrap: on
line source

diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/krb5/Credentials.java openjdk/jdk/src/share/classes/sun/security/krb5/Credentials.java
--- openjdk.orig/jdk/src/share/classes/sun/security/krb5/Credentials.java	2015-10-26 18:40:10.645524086 +0000
+++ openjdk/jdk/src/share/classes/sun/security/krb5/Credentials.java	2015-10-27 01:13:22.017703153 +0000
@@ -35,6 +35,7 @@
 import sun.security.krb5.internal.crypto.EType;
 import java.io.IOException;
 import java.util.Date;
+import java.util.Locale;
 import java.net.InetAddress;
 
 /**
@@ -268,7 +269,7 @@
             // The default ticket cache on Windows is not a file.
             String os = java.security.AccessController.doPrivileged(
                         new sun.security.action.GetPropertyAction("os.name"));
-            if (os.toUpperCase().startsWith("WINDOWS")) {
+            if (os.toUpperCase(Locale.ENGLISH).startsWith("WINDOWS")) {
                 Credentials creds = acquireDefaultCreds();
                 if (creds == null) {
                     if (DEBUG) {
diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java openjdk/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java
--- openjdk.orig/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java	2015-10-26 18:40:10.741522482 +0000
+++ openjdk/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java	2015-10-27 01:13:09.697910241 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.security.cert.CertificateException;
+import java.util.Locale;
 import java.util.Date;
 import java.util.Hashtable;
 import sun.security.x509.CertificateExtensions;
@@ -742,7 +743,7 @@
      * the name.
      */
     public static ObjectIdentifier getOID(String name) {
-        return NAME_OID_TABLE.get(name.toLowerCase());
+        return NAME_OID_TABLE.get(name.toLowerCase(Locale.ENGLISH));
     }
 
     /**
diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java openjdk/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java
--- openjdk.orig/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	2015-10-27 00:25:34.802092132 +0000
+++ openjdk/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	2015-10-27 01:13:09.701910173 +0000
@@ -26,6 +26,7 @@
 
 import java.nio.ByteBuffer;
 import java.util.Arrays;
+import java.util.Locale;
 
 import java.security.*;
 import java.security.spec.*;
@@ -201,7 +202,7 @@
     }
 
     private int parseMode(String mode) throws NoSuchAlgorithmException {
-        mode = mode.toUpperCase();
+        mode = mode.toUpperCase(Locale.ENGLISH);
         int result;
         if (mode.equals("ECB")) {
             result = MODE_ECB;
@@ -222,7 +223,7 @@
             throws NoSuchPaddingException {
         paddingObj = null;
         padBuffer = null;
-        padding = padding.toUpperCase();
+        padding = padding.toUpperCase(Locale.ENGLISH);
         if (padding.equals("NOPADDING")) {
             paddingType = PAD_NONE;
         } else if (padding.equals("PKCS5PADDING")) {
diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java openjdk/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java
--- openjdk.orig/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java	2015-10-27 00:25:35.530079682 +0000
+++ openjdk/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java	2015-10-27 01:13:09.701910173 +0000
@@ -29,6 +29,8 @@
 import java.security.spec.AlgorithmParameterSpec;
 import java.security.spec.*;
 
+import java.util.Locale;
+
 import javax.crypto.*;
 import javax.crypto.spec.*;
 
@@ -118,7 +120,7 @@
 
     protected void engineSetPadding(String padding)
             throws NoSuchPaddingException {
-        String lowerPadding = padding.toLowerCase();
+        String lowerPadding = padding.toLowerCase(Locale.ENGLISH);
         if (lowerPadding.equals("pkcs1Padding")) {
             // empty
         } else {
diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java openjdk/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java
--- openjdk.orig/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java	2015-10-26 18:40:10.833520945 +0000
+++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java	2015-10-27 01:13:09.701910173 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 import sun.security.x509.AccessDescription;
 import sun.security.x509.GeneralNameInterface;
 import sun.security.x509.URIName;
@@ -134,7 +135,7 @@
         }
         this.uri = ((URICertStoreParameters) params).uri;
         // if ldap URI, use an LDAPCertStore to fetch certs and CRLs
-        if (uri.getScheme().toLowerCase().equals("ldap")) {
+        if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals("ldap")) {
             ldap = true;
             ldapCertStore =
                 LDAPCertStore.getInstance(LDAPCertStore.getParameters(uri));
diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/util/Debug.java openjdk/jdk/src/share/classes/sun/security/util/Debug.java
--- openjdk.orig/jdk/src/share/classes/sun/security/util/Debug.java	2015-10-26 18:40:10.933519274 +0000
+++ openjdk/jdk/src/share/classes/sun/security/util/Debug.java	2015-10-27 01:13:09.701910173 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.math.BigInteger;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
+import java.util.Locale;
 
 /**
  * A utility class for debuging.
@@ -262,7 +263,7 @@
             source = left;
 
             // convert the rest to lower-case characters
-            target.append(source.toString().toLowerCase());
+            target.append(source.toString().toLowerCase(Locale.ENGLISH));
 
             return target.toString();
         }
diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/x509/AlgorithmId.java openjdk/jdk/src/share/classes/sun/security/x509/AlgorithmId.java
--- openjdk.orig/jdk/src/share/classes/sun/security/x509/AlgorithmId.java	2015-10-26 18:40:10.973518606 +0000
+++ openjdk/jdk/src/share/classes/sun/security/x509/AlgorithmId.java	2015-10-27 01:13:09.701910173 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -541,9 +541,10 @@
                 for (Enumeration<Object> enum_ = provs[i].keys();
                      enum_.hasMoreElements(); ) {
                     String alias = (String)enum_.nextElement();
+                    String upperCaseAlias = alias.toUpperCase(Locale.ENGLISH);
                     int index;
-                    if (alias.toUpperCase().startsWith("ALG.ALIAS") &&
-                        (index=alias.toUpperCase().indexOf("OID.", 0)) != -1) {
+                    if (upperCaseAlias.startsWith("ALG.ALIAS") &&
+                            (index=upperCaseAlias.indexOf("OID.", 0)) != -1) {
                         index += "OID.".length();
                         if (index == alias.length()) {
                             // invalid alias entry
@@ -553,19 +554,26 @@
                             oidTable = new HashMap<String,ObjectIdentifier>();
                         }
                         oidString = alias.substring(index);
-                        String stdAlgName
-                            = provs[i].getProperty(alias).toUpperCase();
-                        if (oidTable.get(stdAlgName) == null) {
+                        String stdAlgName = provs[i].getProperty(alias);
+                        if (stdAlgName != null) {
+                            stdAlgName = stdAlgName.toUpperCase(Locale.ENGLISH);
+                        }
+                        if (stdAlgName != null &&
+                                oidTable.get(stdAlgName) == null) {
                             oidTable.put(stdAlgName,
                                          new ObjectIdentifier(oidString));
                         }
                     }
                 }
             }
+
+            if (oidTable == null) {
+                oidTable = new HashMap<String,ObjectIdentifier>(1);
+            }
             initOidTable = true;
         }
 
-        return oidTable.get(name.toUpperCase());
+        return oidTable.get(name.toUpperCase(Locale.ENGLISH));
     }
 
     private static ObjectIdentifier oid(int ... values) {
diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/x509/AVA.java openjdk/jdk/src/share/classes/sun/security/x509/AVA.java
--- openjdk.orig/jdk/src/share/classes/sun/security/x509/AVA.java	2015-10-26 18:40:10.973518606 +0000
+++ openjdk/jdk/src/share/classes/sun/security/x509/AVA.java	2015-10-27 01:13:09.701910173 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1222,7 +1222,7 @@
         (String keyword, int standard, Map<String, String> extraKeywordMap)
             throws IOException {
 
-        keyword = keyword.toUpperCase();
+        keyword = keyword.toUpperCase(Locale.ENGLISH);
         if (standard == AVA.RFC2253) {
             if (keyword.startsWith(" ") || keyword.endsWith(" ")) {
                 throw new IOException("Invalid leading or trailing space " +
diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/x509/DNSName.java openjdk/jdk/src/share/classes/sun/security/x509/DNSName.java
--- openjdk.orig/jdk/src/share/classes/sun/security/x509/DNSName.java	2015-10-26 18:40:10.985518405 +0000
+++ openjdk/jdk/src/share/classes/sun/security/x509/DNSName.java	2015-10-27 01:13:09.701910173 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package sun.security.x509;
 
 import java.io.IOException;
+import java.util.Locale;
 
 import sun.security.util.*;
 
@@ -198,8 +199,9 @@
         else if (inputName.getType() != NAME_DNS)
             constraintType = NAME_DIFF_TYPE;
         else {
-            String inName = (((DNSName)inputName).getName()).toLowerCase();
-            String thisName = name.toLowerCase();
+            String inName =
+                (((DNSName)inputName).getName()).toLowerCase(Locale.ENGLISH);
+            String thisName = name.toLowerCase(Locale.ENGLISH);
             if (inName.equals(thisName))
                 constraintType = NAME_MATCH;
             else if (thisName.endsWith(inName)) {
diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/x509/RFC822Name.java openjdk/jdk/src/share/classes/sun/security/x509/RFC822Name.java
--- openjdk.orig/jdk/src/share/classes/sun/security/x509/RFC822Name.java	2015-10-26 18:40:11.001518138 +0000
+++ openjdk/jdk/src/share/classes/sun/security/x509/RFC822Name.java	2015-10-27 01:13:09.701910173 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package sun.security.x509;
 
 import java.io.IOException;
+import java.util.Locale;
 
 import sun.security.util.*;
 
@@ -187,8 +188,9 @@
             constraintType = NAME_DIFF_TYPE;
         } else {
             //RFC2459 specifies that case is not significant in RFC822Names
-            String inName = (((RFC822Name)inputName).getName()).toLowerCase();
-            String thisName = name.toLowerCase();
+            String inName =
+                (((RFC822Name)inputName).getName()).toLowerCase(Locale.ENGLISH);
+            String thisName = name.toLowerCase(Locale.ENGLISH);
             if (inName.equals(thisName)) {
                 constraintType = NAME_MATCH;
             } else if (thisName.endsWith(inName)) {
diff -Nru openjdk.orig/jdk/test/sun/security/x509/AlgorithmId/TurkishRegion.java openjdk/jdk/test/sun/security/x509/AlgorithmId/TurkishRegion.java
--- openjdk.orig/jdk/test/sun/security/x509/AlgorithmId/TurkishRegion.java	1970-01-01 01:00:00.000000000 +0100
+++ openjdk/jdk/test/sun/security/x509/AlgorithmId/TurkishRegion.java	2015-10-27 01:13:09.701910173 +0000
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6867345
+ * @summary Turkish regional options cause NPE in
+ *     sun.security.x509.AlgorithmId.algOID
+ * @run main/othervm -Duser.language=tr -Duser.region=TR TurkishRegion
+ * @author Xuelei Fan
+ */
+
+import sun.security.x509.*;
+
+public class TurkishRegion {
+
+    public static void main(String[] args) throws Exception {
+        AlgorithmId algId = AlgorithmId.get("PBEWITHMD5ANDDES");
+    }
+}