Workaround unicorn handing back bytearrays
This commit is contained in:
parent
b446327f3b
commit
57cbb8beeb
|
@ -976,6 +976,10 @@ class Cs(object):
|
|||
print(code)
|
||||
code = code.encode()
|
||||
print(code)'''
|
||||
# Hack, 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…
Reference in New Issue