mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-06 16:38:36 +00:00
8264561: javap get NegativeArraySizeException on bad instruction
Reviewed-by: vromero
This commit is contained in:
parent
b8856b1c47
commit
cf97252f3f
@ -285,6 +285,8 @@ public class Instruction {
|
||||
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 class Instruction {
|
||||
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 class CodeWriter extends BasicWriter {
|
||||
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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user