8332486: ClassFile API ArrayIndexOutOfBoundsException with label metadata

Reviewed-by: psandoz
This commit is contained in:
Adam Sotona 2024-05-21 07:59:33 +00:00
parent 5f2b8d0224
commit 451cc23905
2 changed files with 19 additions and 1 deletions

View file

@ -221,6 +221,9 @@ public final class CodeImpl
}
private void inflateLabel(int bci) {
if (bci < 0 || bci > codeLength)
throw new IllegalArgumentException(String.format("Bytecode offset out of range; bci=%d, codeLength=%d",
bci, codeLength));
if (labels[bci] == null)
labels[bci] = new LabelImpl(this, bci);
}