Fix logic error in _write_to_mem_with_gadget() #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
raise RopException
in_write_to_mem_with_gadget()
when selected gadget does not pass the checks stating that the next pc must come from the stack rather thanreturn False
_write_to_mem_with_gadget
is called by_try_write_to_mem
using thechain +=
syntax_try_write_to_mem
is called in a try except block for each gadget in_write_to_mem
.The except block excepts the following exceptions:
RopException, angr.errors.SimEngineError, angr.errors.SimUnsatError
Before this change, if the first gadget checked with this workflow did not pass the check, the try block would fail to perform
chain + False
on this line:angrop/angrop/rop_chain.py
Line 33 in 5d44d31
with:
Since
AttributeErrors
are not in the list of excepted errors, the next gadget is not tried.Replacing the
return False
withraise RopException
fixes this issue and allows all of the gadgets to be tried until a working mem writer chain is found.