Skip to content

Commit 004626c

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

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/java_bytecode/java_bytecode_parser.cpp

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

716723
instructions.push_back(instructiont());

0 commit comments

Comments
 (0)