Summary
The OOME statement should be removed from Base64.Decoder.
Problem
The Base64.Decoder specify the OOME error to be thrown by decode methods when the decoded byte array/buffer of needed size can not be allocated. The issue is because of the overflow of an intermediary integer value, not the final value, which should be handled with out throwing the error.
Solution
Remove the OutOfMemoryError statement from Base64.Decoder, as the allocation size of the decoded bytes will never be larger than the input bytes size.
Specification
Update Base64.Decoder spec
from:
* <p> Unless otherwise noted, passing a {@code null} argument to
* a method of this class will cause a
* {@link java.lang.NullPointerException NullPointerException} to
* be thrown.
* <p> If the decoded byte output of the needed size can not
* be allocated, the decode methods of this class will
* cause an {@link java.lang.OutOfMemoryError OutOfMemoryError}
* to be thrown.
to:
* <p> Unless otherwise noted, passing a {@code null} argument to
* a method of this class will cause a
* {@link java.lang.NullPointerException NullPointerException} to
* be thrown.
- csr of
-
JDK-8217969 Base64.Decoder.decode methods do not need to throw OOME due to integer overflow
- Closed