Detect x86 instruction size differences

Check raw code length when instructions have same disassembly
but different encodings. Marks as OpMismatch to indicate
encoding difference.

Fixes #242
Fixes #233
This commit is contained in:
Luke Street 2025-08-30 22:57:19 -06:00
parent 58430d947b
commit 8d24ec6373

View File

@ -496,6 +496,14 @@ fn diff_instruction(
result.right_args_diff.push(InstructionArgDiffIndex::new(b_diff)); result.right_args_diff.push(InstructionArgDiffIndex::new(b_diff));
} }
} }
if result.kind == InstructionDiffKind::None
&& left_resolved.code.len() != right_resolved.code.len()
{
// If everything else matches but the raw code length differs (e.g. x86 instructions
// with same disassembly but different encoding), mark as op mismatch
result.kind = InstructionDiffKind::OpMismatch;
state.diff_score += PENALTY_REG_DIFF;
}
return Ok(result); return Ok(result);
} }