[13] RFR 8217969, 8218265: Base64.Decoder.decode methods ... and java/util/Base64/TestEncodingDecodingLength.java failing

Nishit Jain nishit.jain at oracle.com
Mon Feb 4 15:31:56 UTC 2019


Hi,

Please review the below fix for 8217969 and 8218265

Bug: https://bugs.openjdk.java.net/browse/JDK-8217969
      https://bugs.openjdk.java.net/browse/JDK-8218265

Webrev: http://cr.openjdk.java.net/~nishjain/8217969_8218265/webrev.00/

Issue: Fix for 8210583 changed the Base64.Decoder.decode to throw OOME 
when an integer value overflows, which is an intermediate value, not the 
final value, the final value is always less than Integer.MAX_VALUE. 
Also, the test case written for 8210583, fails on certain platforms and 
throws "OutOfMemoryError: Requested array size exceeds VM limit ", due 
to the array size of length Integer.MAX_VALUE - 2.

Fix: Handled the integer overflow by storing the intermediate value as 
"long" and converting the final value as integer. Also, updating the 
test case input array length to Integer.MAX_VALUE - 8, since MAX_VALUE - 
2 was used only to test the overflow condition in Decoder.decode() which 
is no longer there.

Regards,
Nishit Jain


More information about the core-libs-dev mailing list