edge case bug

This commit is contained in:
Richard Holland
2022-04-26 14:11:43 +00:00
parent c99370e9f0
commit 4b3be856ea

View File

@@ -87,7 +87,8 @@ parseLeb128(std::vector<unsigned char>& buf, int start_offset, int* end_offset)
{\
JLOG(ctx.j.trace())\
<< "HookSet(" << hook::log::SHORT_HOOK << ")[" << HS_ACC() << "]: "\
<< "Malformed transaction: Hook truncated or otherwise invalid\n";\
<< "Malformed transaction: Hook truncated or otherwise invalid. "\
<< "SetHook.cpp:" << __LINE__;\
return {};\
}\
}
@@ -103,6 +104,11 @@ check_guard(
int start_offset, int end_offset, int guard_func_idx, int last_import_idx)
{
if (DEBUG_GUARD_CHECK)
printf("\ncheck_guard called with "
"codesec=%d start_offset=%d end_offset=%d guard_func_idx=%d last_import_idx=%d\n",
codesec, start_offset, end_offset, guard_func_idx, last_import_idx);
if (end_offset <= 0) end_offset = hook.size();
int block_depth = 0;
int mode = 1; // controls the state machine for searching for guards
@@ -134,7 +140,9 @@ check_guard(
printf("\n");
}
int instr = hook[i++]; CHECK_SHORT_HOOK();
CHECK_SHORT_HOOK();
int instr = hook[i++];
instruction_count[block_depth].second++;
if (instr == 0x10) // call instr