summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2023-03-13 23:32:41 -0400
committerdusoleil <howcansocksbereal@gmail.com>2023-03-13 23:32:41 -0400
commite568900727d1f6eb47d92d49ee746abf099a7854 (patch)
tree479d82d6021f87659ec9d70c2f3be669fbec0189
parent7f6ca05f2448e0f17af5d9aa692fc85b21c3af1e (diff)
downloadsploit-e568900727d1f6eb47d92d49ee746abf099a7854.tar.gz
sploit-e568900727d1f6eb47d92d49ee746abf099a7854.zip
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 <howcansocksbereal@gmail.com>
-rw-r--r--sploit/arch.py2
1 files changed, 1 insertions, 1 deletions
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)
-