Skip to content

Commit 8d24ec6

Browse files
committed
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
1 parent 58430d9 commit 8d24ec6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

objdiff-core/src/diff/code.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,14 @@ fn diff_instruction(
496496
result.right_args_diff.push(InstructionArgDiffIndex::new(b_diff));
497497
}
498498
}
499+
if result.kind == InstructionDiffKind::None
500+
&& left_resolved.code.len() != right_resolved.code.len()
501+
{
502+
// If everything else matches but the raw code length differs (e.g. x86 instructions
503+
// with same disassembly but different encoding), mark as op mismatch
504+
result.kind = InstructionDiffKind::OpMismatch;
505+
state.diff_score += PENALTY_REG_DIFF;
506+
}
499507
return Ok(result);
500508
}
501509

0 commit comments

Comments
 (0)