mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-12-14 00:49:53 +00:00
Merge pull request #787 from richo/richo-bytearray
Workaround unicorn handing back bytearrays
This commit is contained in:
commit
cd8d2e2cfa
@ -843,6 +843,10 @@ class Cs(object):
|
|||||||
print(code)
|
print(code)
|
||||||
code = code.encode()
|
code = code.encode()
|
||||||
print(code)'''
|
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))
|
res = _cs.cs_disasm(self.csh, code, len(code), offset, count, ctypes.byref(all_insn))
|
||||||
if res > 0:
|
if res > 0:
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user