diff --git a/jdk/make/mapfiles/libnio/mapfile-linux b/jdk/make/mapfiles/libnio/mapfile-linux index 93e59458abe..a07e4c92ce6 100644 --- a/jdk/make/mapfiles/libnio/mapfile-linux +++ b/jdk/make/mapfiles/libnio/mapfile-linux @@ -60,6 +60,7 @@ SUNWprivate_1.1 { Java_sun_nio_ch_FileChannelImpl_position0; Java_sun_nio_ch_FileChannelImpl_transferTo0; Java_sun_nio_ch_FileChannelImpl_unmap0; + Java_sun_nio_ch_FileDispatcherImpl_allocate0; Java_sun_nio_ch_FileDispatcherImpl_close0; Java_sun_nio_ch_FileDispatcherImpl_closeIntFD; Java_sun_nio_ch_FileDispatcherImpl_force0; diff --git a/jdk/make/mapfiles/libnio/mapfile-macosx b/jdk/make/mapfiles/libnio/mapfile-macosx index a3f6d5d9c1c..4f6a04867d3 100644 --- a/jdk/make/mapfiles/libnio/mapfile-macosx +++ b/jdk/make/mapfiles/libnio/mapfile-macosx @@ -43,6 +43,7 @@ SUNWprivate_1.1 { Java_sun_nio_ch_FileChannelImpl_position0; Java_sun_nio_ch_FileChannelImpl_transferTo0; Java_sun_nio_ch_FileChannelImpl_unmap0; + Java_sun_nio_ch_FileDispatcherImpl_allocate0; Java_sun_nio_ch_FileDispatcherImpl_close0; Java_sun_nio_ch_FileDispatcherImpl_closeIntFD; Java_sun_nio_ch_FileDispatcherImpl_force0; diff --git a/jdk/make/mapfiles/libnio/mapfile-solaris b/jdk/make/mapfiles/libnio/mapfile-solaris index d7a9da908ca..3e9f8491572 100644 --- a/jdk/make/mapfiles/libnio/mapfile-solaris +++ b/jdk/make/mapfiles/libnio/mapfile-solaris @@ -48,6 +48,7 @@ SUNWprivate_1.1 { Java_sun_nio_ch_FileChannelImpl_position0; Java_sun_nio_ch_FileChannelImpl_transferTo0; Java_sun_nio_ch_FileChannelImpl_unmap0; + Java_sun_nio_ch_FileDispatcherImpl_allocate0; Java_sun_nio_ch_FileDispatcherImpl_close0; Java_sun_nio_ch_FileDispatcherImpl_closeIntFD; Java_sun_nio_ch_FileDispatcherImpl_force0; diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/ISO10126Padding.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/ISO10126Padding.java index 7377fab0a9c..a7134238e14 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/ISO10126Padding.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/ISO10126Padding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -68,10 +68,10 @@ final class ISO10126Padding implements Padding { } byte paddingOctet = (byte) (len & 0xff); - byte[] padding = new byte[len]; + byte[] padding = new byte[len - 1]; SunJCE.getRandom().nextBytes(padding); - padding[len-1] = paddingOctet; - System.arraycopy(padding, 0, in, off, len); + System.arraycopy(padding, 0, in, off, len - 1); + in[off + len - 1] = paddingOctet; return; } @@ -101,7 +101,7 @@ final class ISO10126Padding implements Padding { return -1; } - int start = off + len - ((int)lastByte & 0x0ff); + int start = off + len - padValue; if (start < off) { return -1; } diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java index 22afce72bf8..38ce83d91d2 100644 --- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java +++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java @@ -63,10 +63,10 @@ public class DriverResource_ja extends ListResourceBundle { "\u5727\u7E2E\u30AA\u30D7\u30B7\u30E7\u30F3", " -r\u3001--repack jar\u3092\u518D\u5727\u7E2E\u307E\u305F\u306F\u6B63\u898F\u5316\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3001", " jarsigner\u306B\u3088\u308B\u7F72\u540D\u306B\u9069\u3057\u307E\u3059", - " -g\u3001--no-gzip \u30D7\u30EC\u30FC\u30F3\u306A\u5727\u7E2E\u30D5\u30A1\u30A4\u30EB\u3092\u51FA\u529B\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3001", + " -g\u3001--no-gzip \u30D7\u30EC\u30FC\u30F3\u306Apack\u30D5\u30A1\u30A4\u30EB\u3092\u51FA\u529B\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3001", " \u30D5\u30A1\u30A4\u30EB\u5727\u7E2E\u30E6\u30FC\u30C6\u30A3\u30EA\u30C6\u30A3\u306B\u3088\u308B\u5727\u7E2E\u306B\u9069\u3057\u307E\u3059", - " --gzip (\u30C7\u30D5\u30A9\u30EB\u30C8)\u5727\u7E2E\u51FA\u529B\u3092gzip\u3067", - " \u5727\u7E2E\u306E\u5F8C\u51E6\u7406\u3092\u884C\u3044\u307E\u3059", + " --gzip (\u30C7\u30D5\u30A9\u30EB\u30C8) pack\u51FA\u529B\u3092\u5F8C\u51E6\u7406\u3067\u5727\u7E2E\u3057\u307E\u3059", + " (gzip\u3092\u4F7F\u7528)", " -G\u3001--strip-debug \u5727\u7E2E\u4E2D\u306B\u30C7\u30D0\u30C3\u30B0\u5C5E\u6027(SourceFile\u3001", " LineNumberTable\u3001LocalVariableTable", " \u3001LocalVariableTypeTable)\u3092\u524A\u9664\u3057\u307E\u3059", diff --git a/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java b/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java index e222f47c41a..a0e998c7b29 100644 --- a/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java +++ b/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java @@ -350,16 +350,24 @@ public interface ObjectInputFilter { * The first pattern that matches, working from left to right, determines * the {@link Status#ALLOWED Status.ALLOWED} * or {@link Status#REJECTED Status.REJECTED} result. - * If nothing matches, the result is {@link Status#UNDECIDED Status.UNDECIDED}. + * If the limits are not exceeded and no pattern matches the class, + * the result is {@link Status#UNDECIDED Status.UNDECIDED}. * * @param pattern the pattern string to parse; not null - * @return a filter to check a class being deserialized; may be null; + * @return a filter to check a class being deserialized; * {@code null} if no patterns - * @throws IllegalArgumentException - * if a limit is missing the name, or the long value - * is not a number or is negative, - * or the module name is missing if the pattern contains "/" - * or if the package is missing for ".*" and ".**" + * @throws IllegalArgumentException if the pattern string is illegal or + * malformed and cannot be parsed. + * In particular, if any of the following is true: + * */ public static ObjectInputFilter createFilter(String pattern) { Objects.requireNonNull(pattern, "pattern"); @@ -402,14 +410,19 @@ public interface ObjectInputFilter { * Returns an ObjectInputFilter from a string of patterns. * * @param pattern the pattern string to parse - * @return a filter to check a class being deserialized; not null + * @return a filter to check a class being deserialized; + * {@code null} if no patterns * @throws IllegalArgumentException if the parameter is malformed * if the pattern is missing the name, the long value * is not a number or is negative. */ static ObjectInputFilter createFilter(String pattern) { - Global filter = new Global(pattern); - return filter.isEmpty() ? null : filter; + try { + return new Global(pattern); + } catch (UnsupportedOperationException uoe) { + // no non-empty patterns + return null; + } } /** @@ -417,8 +430,10 @@ public interface ObjectInputFilter { * * @param pattern a pattern string of filters * @throws IllegalArgumentException if the pattern is malformed + * @throws UnsupportedOperationException if there are no non-empty patterns */ private Global(String pattern) { + boolean hasLimits = false; this.pattern = pattern; maxArrayLength = Long.MAX_VALUE; // Default values are unlimited @@ -436,6 +451,7 @@ public interface ObjectInputFilter { } if (parseLimit(p)) { // If the pattern contained a limit setting, i.e. type=value + hasLimits = true; continue; } boolean negate = p.charAt(0) == '!'; @@ -510,18 +526,9 @@ public interface ObjectInputFilter { filters.add(c -> moduleName.equals(c.getModule().getName()) ? patternFilter.apply(c) : Status.UNDECIDED); } } - } - - /** - * Returns if this filter has any checks. - * @return {@code true} if the filter has any checks, {@code false} otherwise - */ - private boolean isEmpty() { - return filters.isEmpty() && - maxArrayLength == Long.MAX_VALUE && - maxDepth == Long.MAX_VALUE && - maxReferences == Long.MAX_VALUE && - maxStreamBytes == Long.MAX_VALUE; + if (filters.isEmpty() && !hasLimits) { + throw new UnsupportedOperationException("no non-empty patterns"); + } } /** diff --git a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java index f2c034ed148..ed033d685e9 100644 --- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java +++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java @@ -657,13 +657,11 @@ public class ObjectInputStream *
      *     Class.forName(desc.getName(), false, loader)
      * 
- * where loader is determined as follows: if there is a - * method on the current thread's stack whose declaring class is not a - * - * platform class, then loader is - * the class loader of such class; otherwise, loader - * is the {@linkplain ClassLoader#getPlatformClassLoader() - * platform class loader}. If this call results in a + * where loader is the first class loader on the current + * thread's stack (starting from the currently executing method) that is + * neither the {@linkplain ClassLoader#getPlatformClassLoader() platform + * class loader} nor its ancestor; otherwise, loader is the + * platform class loader. If this call results in a * ClassNotFoundException and the name of the passed * ObjectStreamClass instance is the Java language keyword * for a primitive type or void, then the Class object @@ -721,13 +719,11 @@ public class ObjectInputStream *
      *     Class.forName(i, false, loader)
      * 
- * where loader is determined as follows: if there is a - * method on the current thread's stack whose declaring class is not a - * - * platform class, then loader is - * the class loader of such class; otherwise, loader - * is the {@linkplain ClassLoader#getPlatformClassLoader() - * platform class loader}. + * where loader is the first class loader on the current + * thread's stack (starting from the currently executing method) that is + * neither the {@linkplain ClassLoader#getPlatformClassLoader() platform + * class loader} nor its ancestor; otherwise, loader is the + * platform class loader. * Unless any of the resolved interfaces are non-public, this same value * of loader is also the class loader passed to * Proxy.getProxyClass; if non-public interfaces are present, @@ -1168,6 +1164,13 @@ public class ObjectInputStream * for each class and reference in the stream. * The filter can check any or all of the class, the array length, the number * of references, the depth of the graph, and the size of the input stream. + * The depth is the number of nested {@linkplain #readObject readObject} + * calls starting with the reading of the root of the graph being deserialized + * and the current object being deserialized. + * The number of references is the cumulative number of objects and references + * to objects already read from the stream including the current object being read. + * The filter is invoked only when reading objects from the stream and for + * not primitives. *

* If the filter returns {@link ObjectInputFilter.Status#REJECTED Status.REJECTED}, * {@code null} or throws a {@link RuntimeException}, @@ -1182,8 +1185,9 @@ public class ObjectInputStream * * @implSpec * The filter, when not {@code null}, is invoked during {@link #readObject readObject} - * and {@link #readUnshared readUnshared} for each object - * (regular or class) in the stream including the following: + * and {@link #readUnshared readUnshared} for each object (regular or class) in the stream. + * Strings are treated as primitives and do not invoke the filter. + * The filter is called for: *