Fix cmplog block ID generation to use hashes rather than bit-shifts
MODIFY
frida_mode/src/cmplog/cmplog_arm64.c
frida_mode/src/cmplog/cmplog_arm64.c
@@ -204,10 +204,7 @@ static void cmplog_handle_cmp_sub(GumCpuContext *context, gsize operand1,
gsize address = context->pc;
- register uintptr_t k = (uintptr_t)address;
-
- k = (k >> 4) ^ (k << 8);
- k &= CMP_MAP_W - 1;
+ register uintptr_t k = instrument_get_offset_hash(GUM_ADDRESS(address));
if (__afl_cmp_map->headers[k].type != CMP_TYPE_INS)
__afl_cmp_map->headers[k].hits = 0;

MODIFY
frida_mode/src/cmplog/cmplog_x64.c
frida_mode/src/cmplog/cmplog_x64.c
@@ -188,10 +188,7 @@ static void cmplog_handle_cmp_sub(GumCpuContext *context, gsize operand1,
gsize address = ctx_read_reg(context, X86_REG_RIP);
- register uintptr_t k = (uintptr_t)address;
-
- k = (k >> 4) ^ (k << 8);
- k &= CMP_MAP_W - 7;
+ register uintptr_t k = instrument_get_offset_hash(GUM_ADDRESS(address));
if (__afl_cmp_map->headers[k].type != CMP_TYPE_INS)
__afl_cmp_map->headers[k].hits = 0;

MODIFY
frida_mode/src/cmplog/cmplog_x86.c
frida_mode/src/cmplog/cmplog_x86.c
@@ -193,10 +193,7 @@ static void cmplog_handle_cmp_sub(GumCpuContext *context, gsize operand1,
gsize address = ctx_read_reg(context, X86_REG_EIP);
- register uintptr_t k = (uintptr_t)address;
-
- k = (k >> 4) ^ (k << 8);
- k &= CMP_MAP_W - 1;
+ register uintptr_t k = instrument_get_offset_hash(GUM_ADDRESS(address));
if (__afl_cmp_map->headers[k].type != CMP_TYPE_INS)
__afl_cmp_map->headers[k].hits = 0;

Fix cmplog block ID generation to use hashes rather than bit-shifts