Re: RFR: 8264561: javap get NegativeArraySizeException on bad instruction

2021-05-17 Thread Vicente Romero
On Mon, 17 May 2021 13:11:56 GMT, Adam Sotona  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


RFR: 8264561: javap get NegativeArraySizeException on bad instruction

2021-05-17 Thread Adam Sotona
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=4061=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