RFR: 8320360: ClassFile.parse: Some defect class files cause unexpected exceptions to be thrown [v2]
Adam Sotona
asotona at openjdk.org
Tue Jan 2 13:02:10 UTC 2024
On Thu, 7 Dec 2023 07:53:58 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> ClassFile API throws `IndexOutOfBoundsException` when classfile structure is corrupted so the parser attempts to read beyond the classfile bounds.
>> General contract is that only `IllegalArgumentException` or its subclasses is expected when parser fails.
>> This patch wraps `IndexOutOfBoundsExceptions` thrown from all `ClassReaderImpl.buffer` manipulations into an `IllegalArgumentException("Reading beyond classfile bounds", iOOBECause)`.
>> Relevant tests are added.
>>
>> Please review.
>>
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
>
> - Merge branch 'master' into JDK-8320360-bounds
>
> # Conflicts:
> # test/jdk/jdk/classfile/LimitsTest.java
> - added bug # to the test
> - 8320360: ClassFile.parse: Some defect class files cause unexpected exceptions to be thrown
Thanks for the review!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16762#issuecomment-1873994195
More information about the core-libs-dev
mailing list