Crash case: Invalid write of size 4 in cpu_tb_exec_x86_64.

This commit is contained in:
practicalswift 2015-11-16 23:19:23 +01:00
parent edaea7020b
commit ad5c2eb9c6
3 changed files with 28 additions and 0 deletions

1
.gitignore vendored
View File

@ -112,6 +112,7 @@ eflags_nosync
eflags_noset
mem_map_large
invalid_read_in_cpu_tb_exec
invalid_read_in_cpu_tb_exec_x86_64
#################

View File

@ -17,6 +17,7 @@ TESTS += 00opcode_uc_crash
TESTS += eflags_noset
TESTS += mem_map_large
TESTS += invalid_read_in_cpu_tb_exec
TESTS += invalid_read_in_cpu_tb_exec_x86_64
all: $(TESTS)

View File

@ -0,0 +1,26 @@
#include <unicorn/unicorn.h>
/*
* Disassembly according to capstone:
* mulx rsp, rsp, rdx
*/
#define BINARY "\xc4\xe2\xdb\xf6\xe2"
#define MEMORY_SIZE 2 * 1024 * 1024
#define STARTING_ADDRESS 0x1000000
int main(int argc, char **argv, char **envp) {
uc_engine *uc;
if (uc_open(UC_ARCH_X86, UC_MODE_64, &uc)) {
printf("uc_open(…) failed\n");
return 1;
}
uc_mem_map(uc, STARTING_ADDRESS, MEMORY_SIZE, UC_PROT_ALL);
if (uc_mem_write(uc, STARTING_ADDRESS, BINARY, sizeof(BINARY) - 1)) {
printf("uc_mem_write(…) failed\n");
return 1;
}
printf("uc_emu_start(…)\n");
uc_emu_start(uc, STARTING_ADDRESS, STARTING_ADDRESS + sizeof(BINARY) - 1, 0, 20);
printf("done\n");
return 0;
}