Skip to content

Crash when emulating mips in 2.1.3 #2134

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

Open
peace-maker opened this issue Mar 18, 2025 · 1 comment
Open

Crash when emulating mips in 2.1.3 #2134

peace-maker opened this issue Mar 18, 2025 · 1 comment

Comments

@peace-maker
Copy link

This crashes unicorn 2.1.3 and was fine before:

# from pwnlib.asm import asm
# code = asm('''
# move $t9, $gp
# move $t7, $ra
# jalr $t9
# addiu $t8, $zero, 0x10
# ''', arch='mips', endian='little')
code = b'%\xc8\x80\x03%x\xe0\x03\t\xf8 \x03\x10\x00\x18$'

import unicorn
address = 0x1000
uc = unicorn.Uc(unicorn.UC_ARCH_MIPS, unicorn.UC_MODE_32)

uc.mem_map(address, 0x1000)
uc.mem_write(address, code)

ctx = uc.context_save()
for i, pc in enumerate(range(address, address + len(code), 4)):
    uc.context_restore(ctx)
    try:
        uc.emu_start(pc, until=-1, count=5)
    except unicorn.UcError as error:
        print(error)

pwntools CI crashed due to this.

@wtdcode
Copy link
Member

wtdcode commented Mar 18, 2025

Your observation is correct.

Fixed in 0bb1bbd

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

2 participants