Add test for caf2fe1ddb4c6786e94f8603f27ab2b90edf8872

This commit is contained in:
lazymio 2022-02-25 22:24:17 +01:00
parent caf2fe1ddb
commit 45b5d7d8d2
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873

View File

@ -908,7 +908,32 @@ static void test_x86_nested_emu_stop()
OK(uc_close(uc));
}
TEST_LIST = {{"test_x86_in", test_x86_in},
static void test_x86_nested_emu_start_error_cb(uc_engine *uc, uint64_t addr,
size_t size, void *data)
{
uc_assert_err(UC_ERR_READ_UNMAPPED,
uc_emu_start(uc, code_start + 2, 0, 0, 0));
}
static void test_x86_nested_emu_start_error()
{
uc_engine *uc;
// "nop;nop;mov rax, [0x10000]"
char code[] = "\x90\x90\x48\xa1\x00\x00\x01\x00\x00\x00\x00\x00";
uc_hook hk;
uc_common_setup(&uc, UC_ARCH_X86, UC_MODE_32, code, sizeof(code) - 1);
OK(uc_hook_add(uc, &hk, UC_HOOK_CODE, test_x86_nested_emu_start_error_cb,
NULL, code_start, code_start));
// This call shouldn't fail!
OK(uc_emu_start(uc, code_start, code_start + 2, 0, 0));
OK(uc_close(uc));
}
TEST_LIST = {
{"test_x86_in", test_x86_in},
{"test_x86_out", test_x86_out},
{"test_x86_mem_hook_all", test_x86_mem_hook_all},
{"test_x86_inc_dec_pxor", test_x86_inc_dec_pxor},
@ -936,4 +961,5 @@ TEST_LIST = {{"test_x86_in", test_x86_in},
{"test_x86_cmpxchg", test_x86_cmpxchg},
{"test_x86_nested_emu_start", test_x86_nested_emu_start},
{"test_x86_nested_emu_stop", test_x86_nested_emu_stop},
{"test_x86_nested_emu_start_error", test_x86_nested_emu_start_error},
{NULL, NULL}};