8336833: Endless loop in Javap ClassWriter

Reviewed-by: liach
This commit is contained in:
Adam Sotona 2024-07-22 07:33:29 +00:00
parent 4da9915875
commit 0db6c15efe
2 changed files with 24 additions and 2 deletions

View file

@ -317,7 +317,7 @@ 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) {
if (high < low || (long)high - low > code.codeLength >> 2) {
throw new IllegalArgumentException("Invalid tableswitch values low: " + low + " high: " + high);
}
int cnt = high - low + 1;