From e568900727d1f6eb47d92d49ee746abf099a7854 Mon Sep 17 00:00:00 2001 From: dusoleil Date: Mon, 13 Mar 2023 23:32:41 -0400 Subject: arch: Explicitly convert to int before type conversions Sometimes we might be working on an object that can be treated as an int, but python won't automatically type coerce. For example, grabbing a nested symtbl and passing it in here expecting it to resolve to a type conversion of its base offset. Signed-off-by: dusoleil --- sploit/arch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sploit/arch.py b/sploit/arch.py index 5933a95..8fc139d 100644 --- a/sploit/arch.py +++ b/sploit/arch.py @@ -51,6 +51,7 @@ arch = Arch(**x86_64.__dict__) def __int(i, signed=False, width=None): # type conversion from int to int of given sign and width + i = int(i) width = width or arch.wordsize bits = 8 * width if signed: @@ -110,4 +111,3 @@ def itob(i, width=None, byteorder=None): width = width or arch.wordsize byteorder = byteorder or arch.endianness return __int(i,False,width).to_bytes(width, byteorder, signed=False) - -- cgit v1.2.3