Skip to content

Crash when emulating mips in 2.1.3 #2134

Open
@peace-maker

Description

@peace-maker

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions