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

MIPS CS_GRP_CALL and CS_GRP_RET broken for simple case #1680

Closed
tnballo opened this issue Sep 8, 2020 · 0 comments · Fixed by #2410
Closed

MIPS CS_GRP_CALL and CS_GRP_RET broken for simple case #1680

tnballo opened this issue Sep 8, 2020 · 0 comments · Fixed by #2410

Comments

@tnballo
Copy link

tnballo commented Sep 8, 2020

Script:

import capstone
from capstone import *

cs = Cs(CS_ARCH_MIPS, CS_MODE_32)
cs.detail = True

print(f"Capstone version: {capstone.__version__}")

call_encoding = b'\x40\x00\x00\x0c' # jal 0x100
ret_encoding = b'\x08\x00\xe0\x03'  # jr $ra

for i in cs.disasm(call_encoding, 0):
    print(f"\n0x{i.address:x}\t{i.mnemonic}\t{i.op_str}\t(Groups: {i.groups})")
    print(f"Is call? {capstone.CS_GRP_CALL in i.groups}")

for i in cs.disasm(ret_encoding, 0):
    print(f"\n0x{i.address:x}\t{i.mnemonic}\t{i.op_str}\t(Groups: {i.groups})")
    print(f"Is ret? {capstone.CS_GRP_RET in i.groups}")

Output:

Capstone version: 4.0.2

0x0	jal	0x100	(Groups: [137])
Is call? False

0x0	jr	$ra	(Groups: [137, 1])
Is ret? False

Looks like the latter was identified in #370 (old). This would really be a nice thing to fix for a wide range of binary analyses!

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

Successfully merging a pull request may close this issue.

1 participant