Skip to content

Commit da4ffce

Browse files
author
thk123
committed
Adding invariant to check instruction is normal wide
Only specific instructions can follow a wide byte.
1 parent d597e87 commit da4ffce

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,13 @@ void java_bytecode_parsert::rbytecode(
712712
wide_instruction=true;
713713
address++;
714714
bytecode=read_u1();
715+
// The only valid instructions following a wide byte are
716+
// [ifald]load, [ifald]store, ret and iinc
717+
// All of these have either format of v, or V
718+
INVARIANT(
719+
bytecodes[bytecode].format == 'v' || bytecodes[bytecode].format == 'V',
720+
"Unexpected wide instruction: " +
721+
id2string(bytecodes[bytecode].mnemonic));
715722
}
716723

717724
instructions.push_back(instructiont());

0 commit comments

Comments
 (0)