RFR: 8264561: javap get NegativeArraySizeException on bad instruction

Adam Sotona asotona at openjdk.java.net
Mon May 17 13:18:58 UTC 2021


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.

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

Commit messages:
 - 8264561: javap get NegativeArraySizeException on bad instruction

Changes: https://git.openjdk.java.net/jdk/pull/4061/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4061&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264561
  Stats: 5 lines in 2 files changed: 4 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4061.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4061/head:pull/4061

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


More information about the core-libs-dev mailing list