Skip to content

Commit 9bfe177

Browse files
author
thk123
committed
Adding an early guard for correctly parsed exception table
This must be true, so catching this early is an indicator that something has gone wrong earlier when parsing this bytecode file.
1 parent 6fe1808 commit 9bfe177

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/java_bytecode/java_bytecode_parser.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,12 @@ void java_bytecode_parsert::rmethod_attribute(methodt &method)
947947
{
948948
u2 start_pc=read_u2();
949949
u2 end_pc=read_u2();
950+
951+
INVARIANT(
952+
start_pc < end_pc,
953+
"The start_pc must be less than the end_pc as this is the range the "
954+
"exception is active");
955+
950956
u2 handler_pc=read_u2();
951957
u2 catch_type=read_u2();
952958
method.exception_table[e].start_pc=start_pc;

0 commit comments

Comments
 (0)