JDK-8218265 : java/util/Base64/TestEncodingDecodingLength.java failing
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 13
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-02-03
  • Updated: 2022-12-21
  • Resolved: 2019-02-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13
13 b07Fixed
Related Reports
Relates :  
Description
The test added by JDK-8210583 always fails:

java.lang.OutOfMemoryError: Requested array size exceeds VM limit
	at TestEncodingDecodingLength.main(TestEncodingDecodingLength.java:41)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:835)


40:         int size = Integer.MAX_VALUE - 2;
41:        byte[] inputBytes = new byte[size];

Unclear whether this is platform/configuration specific as a standalone test on linux-x64 can execute the above okay.

Comments
Test with jdk13 build 32 on windows10 x64 and Linux x64, passed.
07-08-2019

URL: http://hg.openjdk.java.net/jdk/jdk/rev/c6e8196e4b54 User: nishjain Date: 2019-02-06 08:28:03 +0000
06-02-2019

Disabling compressedOOPs reduces the maximum array size to Integer.MAX_VALUE - 3.
04-02-2019

As fixed by JDK-8210583, Decoder.decode needed Integer.MAX_VALUE - 2 as an input array size to test the overflow condition, but now it is observed that only the intermediate value overflows while decoding, not the final value, so an issue is filed to update it (JDK-8217969), with this fix, Integer.MAX_VALUE - 2 can be changed to Integer.MAX_VALUE - 8.
04-02-2019

I don't know what configurations allows or disallow creating an array of size Integer.MAX_VALUE-2 but historically we've used Integer.MAX_VALUE-8 as a limit that avoids issues like this. If needed, we can exclude this test until the conditions are better understood.
03-02-2019