CSR :
|
|
Relates :
|
|
Relates :
|
JDK-8217706 :
|
ADDITIONAL SYSTEM INFORMATION : openjdk version "11-ea" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11-ea+26) OpenJDK 64-Bit Server VM 18.9 (build 11-ea+26, mixed mode) A DESCRIPTION OF THE PROBLEM : Base64.Encoder incorrectly handles arrays of sizes that approach Integer.MAX_VALUE. Due to a bug in the implementation, a NegativeArraySizeException may be thrown during encoding. Instead, it should either complete the encoding successfully, or throw an OutOfMemoryError. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : launch jshell: jshell -R-Xmx8G and execute the following 2 commands (the first will take quite some time): byte[] input = new byte[Integer.MAX_VALUE-2]; byte[] output = Base64.getEncoder().encode(input); EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Either no exception occurs, or an OutOfMemoryError is thrown ACTUAL - | Exception java.lang.NegativeArraySizeException: -1431655768 | at Base64$Encoder.encode (Base64.java:265) | at (#6:1)
|