RFR: 8242882: opening jar file with large manifest might throw NegativeArraySizeException [v2]

Brent Christian bchristi at openjdk.java.net
Wed Sep 30 17:36:10 UTC 2020


On Wed, 23 Sep 2020 15:09:44 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address the review comments and introduce an array size check in JarFile.getBytes() method itself
>
> test/jdk/java/util/jar/JarFile/LargeManifestOOMTest.java line 60:
> 
>> 58:         final OutOfMemoryError oome = Assert.expectThrows(OutOfMemoryError.class, () -> jar.getManifest());
>> 59:         // additionally verify that the OOM was for the right/expected reason
>> 60:         if (!"Required array size too large".equals(oome.getMessage())) {
> 
> I wasn't too sure if I should add this additional check on the message of the `OutOfMemoryError`, but decided to do it
> anyway, given that from what I remember there were some discussions in the `core-libs-dev` list a while back on the
> exact messages that such OOMs should throw. So I guessed that it might be OK to rely on those messages in the tests
> within this project. However, I am open to removing specific check if it's considered unnecessary.

I think it's fine either way.

-------------

PR: https://git.openjdk.java.net/jdk/pull/323


More information about the core-libs-dev mailing list