From cfd6775d4bdf93b1582e3daed2dc446a58f6f92c Mon Sep 17 00:00:00 2001 From: astewart-bah <126896449+astewart-bah@users.noreply.github.com> Date: Wed, 14 Feb 2024 14:27:27 -0500 Subject: [PATCH] Update mem_changer.py 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. --- angrop/chain_builder/mem_changer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/angrop/chain_builder/mem_changer.py b/angrop/chain_builder/mem_changer.py index 1d55f54..de2bc8b 100644 --- a/angrop/chain_builder/mem_changer.py +++ b/angrop/chain_builder/mem_changer.py @@ -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!")