2015-08-24 19:02:31 +03:00
|
|
|
#include <unicorn/unicorn.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#define UC_BUG_WRITE_SIZE 128
|
|
|
|
#define UC_BUG_WRITE_ADDR 0x2000
|
|
|
|
|
2023-10-08 14:39:13 +03:00
|
|
|
int main(void)
|
2015-08-24 19:02:31 +03:00
|
|
|
{
|
|
|
|
int size;
|
2015-09-05 06:20:32 +03:00
|
|
|
uc_engine *uc;
|
2015-08-26 16:29:28 +03:00
|
|
|
|
|
|
|
uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uc);
|
2015-08-24 19:02:31 +03:00
|
|
|
if (err) {
|
|
|
|
fprintf (stderr, "Cannot initialize unicorn\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
size = UC_BUG_WRITE_SIZE;
|
2015-08-30 07:02:33 +03:00
|
|
|
if (!uc_mem_map (uc, UC_BUG_WRITE_ADDR, size, UC_PROT_ALL)) {
|
|
|
|
uc_mem_write (uc, UC_BUG_WRITE_ADDR,
|
2015-08-28 13:21:36 +03:00
|
|
|
(const uint8_t*)"\xff\xff\xff\xff\xff\xff\xff\xff", 8);
|
2015-08-24 19:02:31 +03:00
|
|
|
}
|
2015-08-26 16:29:28 +03:00
|
|
|
err = uc_emu_start(uc, UC_BUG_WRITE_ADDR, UC_BUG_WRITE_ADDR+8, 0, 1);
|
|
|
|
uc_close(uc);
|
2015-08-24 19:02:31 +03:00
|
|
|
printf ("Error = %u (%s)\n", err, uc_strerror(err));
|
|
|
|
return err? -1: 0;
|
|
|
|
}
|