Handle invalid instructions as end block

This commit is contained in:
Sajid 2024-09-13 16:13:37 +06:00
parent 5cef220e9f
commit 87a74e2001

View File

@ -120,7 +120,7 @@ Function Function::Analyze(const void* code, size_t size, size_t base)
RESTORE_DATA(); RESTORE_DATA();
} }
else if (op == PPC_OP_B || instruction == 0 || insn.opcode->id == PPC_INST_BLR) // b, blr, end padding else if (op == PPC_OP_B || instruction == 0 || (insn.opcode != nullptr && insn.opcode->id == PPC_INST_BLR)) // b, blr, end padding
{ {
if (!isLink) if (!isLink)
{ {
@ -173,6 +173,11 @@ Function Function::Analyze(const void* code, size_t size, size_t base)
RESTORE_DATA(); RESTORE_DATA();
} }
} }
else if (insn.opcode == nullptr)
{
blockStack.pop_back();
RESTORE_DATA();
}
} }
// Sort and invalidate discontinuous blocks // Sort and invalidate discontinuous blocks