Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGSEGV in X86GenAsmWriter1 #463

Closed
toastedcornflakes opened this issue Aug 20, 2015 · 3 comments
Closed

SIGSEGV in X86GenAsmWriter1 #463

toastedcornflakes opened this issue Aug 20, 2015 · 3 comments

Comments

@toastedcornflakes
Copy link

I encountered a crash in x64 disassembler (compiled with diet mode, latest master)

from capstone import *
from binascii import unhexlify
md = Cs(CS_ARCH_X86, CS_MODE_64)
d = md.disasm(unhexlify("402626485166646466666c695166430100f8666253554103f7de05"), 0x1000)
for i in d:
    print("0x%x:\t%s\t%s" %(i.address, i.mnemonic, i.op_str))

Stopped reason: SIGSEGV
0x00000000004d549a in getRegisterName (RegNo=0x0) at arch/X86/X86GenAsmWriter1.inc:15023
15023     return AsmStrs+RegAsmOffset[RegNo-1];
@aquynh
Copy link
Collaborator

aquynh commented Aug 21, 2015

which Capstone version are you using? i am quite sure that the latest version 3.0.4 does not allow you to access to i.mnemonic, which is irrelevant in DIET mode.

thanks.

@toastedcornflakes
Copy link
Author

Sorry, my snippet was wrong. The crash is reproducible just by calling capstone.disasm and consuming the iterator. Using the DIET mode or not is irrelevant. The crash still occurs with full capstone:

from capstone import *
from binascii import unhexlify
md = Cs(CS_ARCH_X86, CS_MODE_64)
d = md.disasm(unhexlify("402626485166646466666c695166430100f8666253554103f7de05"), 0x1000)
list(d)

(I also reinstalled the bindings, not sure if that was necessary)

I'm running capstone from commit 763ac62

@aquynh
Copy link
Collaborator

aquynh commented Aug 23, 2015

confirmed. will see how to fix this, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants