From e7822d178b36a40f1888017f354602e2833c3e4a Mon Sep 17 00:00:00 2001 From: elyashiv Date: Wed, 16 Aug 2023 10:21:10 +0300 Subject: [PATCH] Update rop.py Use memoryview to avoid copying data --- ropper/rop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ropper/rop.py b/ropper/rop.py index 5e43a2c..2f2e32d 100644 --- a/ropper/rop.py +++ b/ropper/rop.py @@ -297,7 +297,7 @@ def searchGadgets(self, binary, instructionCount=5, gtype=GadgetType.ALL, multip def _searchGadgetsSingle(self, section, binary, instruction_count=5, gtype=GadgetType.ALL): toReturn = [] - code = bytes(bytearray(section.bytes)) + code = memoryview(section.bytes) # TODO: Another solution should be used here. This is a hack for compatibility reasons. to resolve the gadget address calculation of segments of elf files have a different base address if calculated segment.virtualAddress - segment.offset offset = section.offset - (binary.originalImageBase - (section.virtualAddress - section.offset)) #offset = section.offset