Skip to content

Commit 35cf129

Browse files
author
thk123
committed
Correctly handle wide iload commands
These commands occur when there are >255 local variables. In these cases the index of the local variable is represented using a u2 rather than a u1.
1 parent 0df054c commit 35cf129

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,20 @@ void java_bytecode_parsert::rbytecode(
773773

774774
case 'v': // local variable index (one byte)
775775
{
776-
u1 v=read_u1();
777-
instruction.args.push_back(from_integer(v, unsignedbv_typet(8)));
776+
if(wide_instruction)
777+
{
778+
u2 v = read_u2();
779+
instruction.args.push_back(from_integer(v, unsignedbv_typet(16)));
780+
address += 2;
781+
}
782+
else
783+
{
784+
u1 v = read_u1();
785+
instruction.args.push_back(from_integer(v, unsignedbv_typet(8)));
786+
address += 1;
787+
}
778788
}
779-
address+=1;
789+
780790
break;
781791

782792
case 'V':

0 commit comments

Comments
 (0)