Skip to content

Commit

Permalink
Fix extraction of shift value for immediate instructions
Browse files Browse the repository at this point in the history
The shift value must be treated as an unsigned integer otherwise
a shift value such as '0b11111' would be interpreted as -1 instead
of 31.
  • Loading branch information
nmeum committed Apr 29, 2024
1 parent c37d403 commit ed96240
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions angr_platforms/risc_v/instrs_riscv/instruction_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def get_imm(self):
return self.constant(data, Type.int_32)

def get_shift_amount(self):
num = BitArray(bin=self.data['I']).int
return self.constant(num, Type.int_8)
num = BitArray(bin=self.data['I'])
return self.constant(num.uint, Type.int_8)

def get_optional_func7(self):
return self.data['i']
Expand Down

0 comments on commit ed96240

Please sign in to comment.