mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-03-03 11:57:14 +00:00
For the benefit of mankind. (#1386)
For the peace and tranquility of the earth.
This commit is contained in:
parent
b8640cb953
commit
534194f3fc
@ -1051,7 +1051,7 @@ class Cs(object):
|
||||
print(code)
|
||||
code = code.encode()
|
||||
print(code)'''
|
||||
# Hack, unicorn's memory accessors give you back bytearrays, but they
|
||||
# Hi, Hacker! Unicorn's memory accessors give you back bytearrays, but they
|
||||
# cause TypeErrors when you hand them into Capstone.
|
||||
if isinstance(code, bytearray):
|
||||
code = bytes(code)
|
||||
@ -1079,6 +1079,10 @@ class Cs(object):
|
||||
raise CsError(CS_ERR_DIET)
|
||||
|
||||
all_insn = ctypes.POINTER(_cs_insn)()
|
||||
# Hi, Hacker! Unicorn's memory accessors give you back bytearrays, but they
|
||||
# cause TypeErrors when you hand them into Capstone.
|
||||
if isinstance(code, bytearray):
|
||||
code = bytes(code)
|
||||
res = _cs.cs_disasm(self.csh, code, len(code), offset, count, ctypes.byref(all_insn))
|
||||
if res > 0:
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user