< prev index next >

src/share/classes/java/security/cert/CertificateRevokedException.java

Print this page
rev 12546 : 8181432: Better processing of unresolved permissions
Reviewed-by: mullan

*** 1,7 **** /* ! * Copyright (c) 2007, 2014, 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. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2007, 2017, 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. Oracle designates this
*** 32,41 **** --- 32,42 ---- import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.security.auth.x500.X500Principal; + import sun.misc.IOUtils; import sun.security.util.ObjectIdentifier; import sun.security.x509.InvalidityDateExtension; /** * An exception that indicates an X.509 certificate is revoked. A
*** 226,246 **** // Read in the size (number of mappings) of the extensions map // and create the extensions map int size = ois.readInt(); if (size == 0) { extensions = Collections.emptyMap(); } else { ! extensions = new HashMap<String, Extension>(size); } // Read in the extensions and put the mappings in the extensions map for (int i = 0; i < size; i++) { String oid = (String) ois.readObject(); boolean critical = ois.readBoolean(); ! int length = ois.readInt(); ! byte[] extVal = new byte[length]; ! ois.readFully(extVal); Extension ext = sun.security.x509.Extension.newExtension (new ObjectIdentifier(oid), critical, extVal); extensions.put(oid, ext); } } --- 227,247 ---- // Read in the size (number of mappings) of the extensions map // and create the extensions map int size = ois.readInt(); if (size == 0) { extensions = Collections.emptyMap(); + } else if (size < 0) { + throw new IOException("size cannot be negative"); } else { ! extensions = new HashMap<>(size > 20 ? 20 : size); } // Read in the extensions and put the mappings in the extensions map for (int i = 0; i < size; i++) { String oid = (String) ois.readObject(); boolean critical = ois.readBoolean(); ! byte[] extVal = IOUtils.readNBytes(ois, ois.readInt()); Extension ext = sun.security.x509.Extension.newExtension (new ObjectIdentifier(oid), critical, extVal); extensions.put(oid, ext); } }
< prev index next >