Skip to content

Commit

Permalink
Update mem_changer.py
Browse files Browse the repository at this point in the history
Fixed logic error with a for loop in a try block, where each loop could raise an exception causing only the first gadget to ever be checked if the first gadget fails one of the checks.
  • Loading branch information
astewart-bah authored Feb 14, 2024
1 parent 92dc6fb commit cfd6775
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions angrop/chain_builder/mem_changer.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ def add_to_mem(self, addr, value, data_size=None):
l.debug("Now building the mem add chain")

# try to build the chain
try:
for g in gadgets:
for g in gadgets:
try:
chain = self._add_mem_with_gadget(g, addr, data_size, difference=value)
self.verify(chain, addr, value, data_size)
return chain
except RopException:
pass
except RopException:
pass

raise RopException("Fail to perform add_to_mem!")

Expand Down

0 comments on commit cfd6775

Please sign in to comment.