mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8331320: ClassFile API OutOfMemoryError with certain class files
Reviewed-by: psandoz
This commit is contained in:
parent
6f98d8f58f
commit
e2c0cfef14
2 changed files with 60 additions and 1 deletions
|
@ -262,6 +262,9 @@ public abstract sealed class AbstractInstruction
|
|||
|
||||
this.afterPad = pos + 1 + ((4 - ((pos + 1 - code.codeStart) & 3)) & 3);
|
||||
this.npairs = code.classReader.readInt(afterPad + 4);
|
||||
if (npairs < 0 || npairs > code.codeLength >> 3) {
|
||||
throw new IllegalArgumentException("Invalid lookupswitch npairs value: " + npairs);
|
||||
}
|
||||
}
|
||||
|
||||
static int size(CodeImpl code, int codeStart, int pos) {
|
||||
|
@ -314,6 +317,9 @@ public abstract sealed class AbstractInstruction
|
|||
int pad = ap - (pos + 1);
|
||||
int low = code.classReader.readInt(ap + 4);
|
||||
int high = code.classReader.readInt(ap + 8);
|
||||
if (high < low || high - low > code.codeLength >> 2) {
|
||||
throw new IllegalArgumentException("Invalid tableswitch values low: " + low + " high: " + high);
|
||||
}
|
||||
int cnt = high - low + 1;
|
||||
return 1 + pad + 12 + cnt * 4;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue