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:11 UTC 2024


On Tue, 2 Jan 2024 07:03:55 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> 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
>
> src/java.base/share/classes/jdk/internal/classfile/impl/ClassReaderImpl.java line 200:
> 
>> 198:         try {
>> 199:             return buffer[p] & 0xFF;
>> 200:         } catch (IndexOutOfBoundsException e) {
> 
> This and all other catch blocks introduced in this change can be changed to the specific exception type `ArrayIndexOutOfBoundsException`, because all these operations are dealing with only array access. If you prefer catching this more generic `IndexOutOfBoundsException`, that's fine with me.

Yes, I prefer the generic `IndexOutOfBoundsException`, thanks.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16762#discussion_r1439426562


More information about the core-libs-dev mailing list