@@ -756,17 +756,21 @@ void java_bytecode_parsert::rbytecode(
756
756
case ' o' : // two byte branch offset, signed
757
757
{
758
758
s2 offset=read_u2 ();
759
+ // By converting the signed offset into an absolute address (by adding
760
+ // the current address) the number represented becomes unsigned.
759
761
instruction.args .push_back (
760
- from_integer (address+offset, signedbv_typet (16 )));
762
+ from_integer (address+offset, unsignedbv_typet (16 )));
761
763
}
762
764
address+=2 ;
763
765
break ;
764
766
765
767
case ' O' : // four byte branch offset, signed
766
768
{
767
769
s4 offset=read_u4 ();
770
+ // By converting the signed offset into an absolute address (by adding
771
+ // the current address) the number represented becomes unsigned.
768
772
instruction.args .push_back (
769
- from_integer (address+offset, signedbv_typet (32 )));
773
+ from_integer (address+offset, unsignedbv_typet (32 )));
770
774
}
771
775
address+=4 ;
772
776
break ;
@@ -820,8 +824,10 @@ void java_bytecode_parsert::rbytecode(
820
824
821
825
// now default value
822
826
s4 default_value=read_u4 ();
827
+ // By converting the signed offset into an absolute address (by adding
828
+ // the current address) the number represented becomes unsigned.
823
829
instruction.args .push_back (
824
- from_integer (base_offset+default_value, signedbv_typet (32 )));
830
+ from_integer (base_offset+default_value, unsignedbv_typet (32 )));
825
831
address+=4 ;
826
832
827
833
// number of pairs
@@ -834,8 +840,10 @@ void java_bytecode_parsert::rbytecode(
834
840
s4 offset=read_u4 ();
835
841
instruction.args .push_back (
836
842
from_integer (match, signedbv_typet (32 )));
843
+ // By converting the signed offset into an absolute address (by adding
844
+ // the current address) the number represented becomes unsigned.
837
845
instruction.args .push_back (
838
- from_integer (base_offset+offset, signedbv_typet (32 )));
846
+ from_integer (base_offset+offset, unsignedbv_typet (32 )));
839
847
address+=8 ;
840
848
}
841
849
}
@@ -867,8 +875,10 @@ void java_bytecode_parsert::rbytecode(
867
875
{
868
876
s4 offset=read_u4 ();
869
877
instruction.args .push_back (from_integer (i, signedbv_typet (32 )));
878
+ // By converting the signed offset into an absolute address (by adding
879
+ // the current address) the number represented becomes unsigned.
870
880
instruction.args .push_back (
871
- from_integer (base_offset+offset, signedbv_typet (32 )));
881
+ from_integer (base_offset+offset, unsignedbv_typet (32 )));
872
882
address+=4 ;
873
883
}
874
884
}
0 commit comments