Closed
Description
When trying to write to an already mapped addr, error UC_ERR_WRITE_UNMAPPED
occurred.
$ python3 test1.py
ERROR: Invalid memory write (UC_ERR_WRITE_UNMAPPED)
And the corresponding code is as follows.
from __future__ import print_function
from unicorn import *
from unicorn.mips_const import *
# code to be emulated
MISP_CODE32 = b"\x00\x00\x00\x00"
ADDRESS = 0x90000000
ADDRESS_END = 0xabbfe000
try:
# Initialize emulator in X86-32bit mode
mu = Uc(UC_ARCH_MIPS, UC_MODE_MIPS32 + UC_MODE_BIG_ENDIAN)
mu.mem_map(ADDRESS, ADDRESS_END - ADDRESS)
# write machine code to be emulated to memory
mu.mem_write(ADDRESS_END - 0x1000, MISP_CODE32)
except UcError as e:
print("ERROR: %s" % e)
The version of installed unicorn is latest version 1.0.2
, the machine is Ubuntu 18.04
.
$ pip3 list | grep unicorn
unicorn 1.0.2
Thanks!