Format code

This commit is contained in:
mio
2025-03-10 11:31:53 +08:00
parent d3674f84b4
commit 3870cdcaf3
5 changed files with 35 additions and 31 deletions

View File

@@ -277,8 +277,8 @@ static void test_uc_hook_cached_uaf(void)
uc_common_setup(&uc, UC_ARCH_X86, UC_MODE_32, code, sizeof(code) - 1);
OK(uc_hook_add(uc, &h, UC_HOOK_CODE, (void *)test_uc_hook_cached_cb, (void *)&count, 1,
0));
OK(uc_hook_add(uc, &h, UC_HOOK_CODE, (void *)test_uc_hook_cached_cb,
(void *)&count, 1, 0));
OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0));
@@ -288,9 +288,10 @@ static void test_uc_hook_cached_uaf(void)
// This will clear deleted hooks and SHOULD clear cache.
OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0));
// Now hooks are deleted and thus this _should not_ call test_uc_hook_cached_cb anymore.
// If the hook is allocated like from malloc, and the code region is free-ed, this call _shall not_
// call the hook anymore to avoid UAF.
// Now hooks are deleted and thus this _should not_ call
// test_uc_hook_cached_cb anymore. If the hook is allocated like from
// malloc, and the code region is free-ed, this call _shall not_ call the
// hook anymore to avoid UAF.
OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0));
// Only 4 calls

View File

@@ -107,13 +107,14 @@ static void test_mips_stop_delay_slot_from_qiling(void)
// 24 ab ff da addiu $t3, $a1, -0x26
// 2d 62 00 02 sltiu $v0, $t3, 2
// 10 40 00 32 beqz $v0, 0x47c8c9c
// 00 00 00 00 nop
// 00 00 00 00 nop
char code[] =
"\x24\x06\x00\x03\x10\xa6\x00\x79\x30\x42\x00\xfc\x10\x40\x00\x32\x24\xab\xff\xda\x2d\x62\x00\x02\x10\x40\x00\x32\x00\x00\x00\x00";
"\x24\x06\x00\x03\x10\xa6\x00\x79\x30\x42\x00\xfc\x10\x40\x00\x32\x24"
"\xab\xff\xda\x2d\x62\x00\x02\x10\x40\x00\x32\x00\x00\x00\x00";
uint32_t r_pc = 0x0;
uint32_t r_v0 = 0xff;
uint32_t r_a1 = 0x3;
uc_common_setup(&uc, UC_ARCH_MIPS, UC_MODE_MIPS32 | UC_MODE_BIG_ENDIAN,
code, sizeof(code) - 1);
OK(uc_reg_write(uc, UC_MIPS_REG_V0, &r_v0));
@@ -207,5 +208,6 @@ TEST_LIST = {
{"test_mips_lwx_exception_issue_1314", test_mips_lwx_exception_issue_1314},
{"test_mips_mips16", test_mips_mips16},
{"test_mips_mips_fpr", test_mips_mips_fpr},
{"test_mips_stop_delay_slot_from_qiling", test_mips_stop_delay_slot_from_qiling},
{"test_mips_stop_delay_slot_from_qiling",
test_mips_stop_delay_slot_from_qiling},
{NULL, NULL}};