RFR: 8264561: javap get NegativeArraySizeException on bad instruction

Vicente Romero vromero at openjdk.java.net
Mon May 17 14:50:40 UTC 2021


On Mon, 17 May 2021 13:11:56 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> Actual javap implementation reacts on corrupted TABLESWITCH or LOOKUPSWITCH bytecode instructions resulting to negative array allocation with NegativeArraySizeException, which is reported to user with stack trace and as serious internal error.
> 
> The fix in c.s.t.classfile.Instruction is checking for negative array size of corrupted TABLESWITCH or LOOKUPSWITCH bytecode and throwing j.l.IllegalStateException instead of the NegativeArraySizeException.
>  
> Another part of the fix in c.s.t.javap.CodeWriter is catching j.l.IllegalStateException and reporting it as error in the analyzed bytecode, instead of passing it up and causing serious internal javap error.

lgtm

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

Marked as reviewed by vromero (Reviewer).

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


More information about the core-libs-dev mailing list