Skip to content

Commit e976d6f

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 96bf623 commit e976d6f

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/java_bytecode/java_bytecode_parser.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,6 @@ void java_bytecode_parsert::rbytecode(
749749
instruction.args.push_back(from_integer(c, signedbv_typet(8)));
750750
}
751751
address+=1;
752-
753752
break;
754753

755754
case 'o': // two byte branch offset, signed
@@ -776,10 +775,20 @@ void java_bytecode_parsert::rbytecode(
776775

777776
case 'v': // local variable index (one byte)
778777
{
779-
u1 v=read_u1();
780-
instruction.args.push_back(from_integer(v, unsignedbv_typet(8)));
778+
if(wide_instruction)
779+
{
780+
u2 v = read_u2();
781+
instruction.args.push_back(from_integer(v, unsignedbv_typet(16)));
782+
address += 2;
783+
}
784+
else
785+
{
786+
u1 v = read_u1();
787+
instruction.args.push_back(from_integer(v, unsignedbv_typet(8)));
788+
address += 1;
789+
}
781790
}
782-
address+=1;
791+
783792
break;
784793

785794
case 'V':

0 commit comments

Comments
 (0)