Skip to content
Permalink
Browse files
8264561: javap get NegativeArraySizeException on bad instruction
Reviewed-by: vromero
  • Loading branch information
Adam Sotona committed May 17, 2021
1 parent b8856b1 commit cf97252f3fd4e7bdb57271b92dd2866101d4a94b
@@ -285,6 +285,8 @@ public Kind getKind() {
int default_ = getInt(pad);
int low = getInt(pad + 4);
int high = getInt(pad + 8);
if (low > high)
throw new IllegalStateException();
int[] values = new int[high - low + 1];
for (int i = 0; i < values.length; i++)
values[i] = getInt(pad + 12 + 4 * i);
@@ -295,6 +297,8 @@ public Kind getKind() {
int pad = align(pc + 1) - pc;
int default_ = getInt(pad);
int npairs = getInt(pad + 4);
if (npairs < 0)
throw new IllegalStateException();
int[] matches = new int[npairs];
int[] offsets = new int[npairs];
for (int i = 0; i < npairs; i++) {
@@ -106,7 +106,7 @@ public void writeInstrs(Code_attribute attr) {
for (InstructionDetailWriter w: detailWriters)
w.writeDetails(instr);
writeInstr(instr);
} catch (ArrayIndexOutOfBoundsException e) {
} catch (ArrayIndexOutOfBoundsException | IllegalStateException e) {
println(report("error at or after byte " + instr.getPC()));
break;
}

0 comments on commit cf97252

Please sign in to comment.