From ebaa542702625d248282f79f4fd4852c3e24e0be Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 24 Aug 2015 20:21:57 +0800 Subject: [PATCH] revert regress/map_crash.c back to original code --- regress/Makefile | 6 ++---- regress/map_crash.c | 42 +++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/regress/Makefile b/regress/Makefile index 10f6c0d6..4fcfac82 100644 --- a/regress/Makefile +++ b/regress/Makefile @@ -1,7 +1,5 @@ -.PHONY: all clean - -CFLAGS+=-I../include -LDFLAGS=-L.. -lunicorn +CFLAGS += -I../include +LDFLAGS = -L.. -lunicorn TESTS = map_crash diff --git a/regress/map_crash.c b/regress/map_crash.c index 375a3fa1..4d6bc8fe 100644 --- a/regress/map_crash.c +++ b/regress/map_crash.c @@ -4,27 +4,27 @@ #include #define UC_BUG_WRITE_SIZE 13000 -//#define UC_BUG_WRITE_ADDR 0x1000 -#define UC_BUG_WRITE_ADDR 0x2000 +#define UC_BUG_WRITE_ADDR 0x1000 // fix this by change this to 0x2000 int main() { - int size; - uint8_t *buf; - uch uh; - uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uh); - if (err) { - fprintf (stderr, "Cannot initialize unicorn\n"); - return 1; - } - size = UC_BUG_WRITE_SIZE; - buf = malloc (size); - if (!buf) { - fprintf (stderr, "Cannot allocate\n"); - return 1; - } - memset (buf, 0, size); - uc_mem_map (uh, UC_BUG_WRITE_ADDR, size); - uc_mem_write (uh, UC_BUG_WRITE_ADDR, buf, size); - uc_close (&uh); - return 0; + int size; + uint8_t *buf; + uch uh; + uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uh); + if (err) { + fprintf (stderr, "Cannot initialize unicorn\n"); + return 1; + } + size = UC_BUG_WRITE_SIZE; + buf = malloc (size); + if (!buf) { + fprintf (stderr, "Cannot allocate\n"); + return 1; + } + memset (buf, 0, size); + if (!uc_mem_map (uh, UC_BUG_WRITE_ADDR, size)) { + uc_mem_write (uh, UC_BUG_WRITE_ADDR, buf, size); + } + uc_close (&uh); + return 0; }