Skip to content

Strip trailing int3 instructions (alignment padding) for x64#354

Merged
encounter merged 3 commits into
encounter:mainfrom
HaydnTrigg:x86_x64_int3_comparison
Jun 2, 2026
Merged

Strip trailing int3 instructions (alignment padding) for x64#354
encounter merged 3 commits into
encounter:mainfrom
HaydnTrigg:x86_x64_int3_comparison

Conversation

@HaydnTrigg
Copy link
Copy Markdown
Contributor

Trying to do some comparison against objects compiled for x64 code with VS2012 17.0.65501.17028

The functions have unreliable sizes due to padding where a function may be 3 bytes large, but after adding a second function it will pad out to 16 byte alignment. However the newly added function is still only 1 byte aligned. This change removes trailing int3 instructions for comparison which are used to pad x64.

Before matching %
image

Problem instructions
image

After %
image

@HaydnTrigg HaydnTrigg force-pushed the x86_x64_int3_comparison branch 2 times, most recently from 54adbe6 to d99656d Compare May 28, 2026 15:35
Comment thread objdiff-core/src/arch/x86.rs Outdated
}
// Strip trailing int3 instructions (alignment padding) for x64
if matches!(self.arch, Architecture::X86_64) {
while out.last().map(|i| i.opcode == iced_x86::Mnemonic::Int3 as u16).unwrap_or(false) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny nit: .map_or is slightly nicer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed up. Then clippy had other plans and wants to use is_some_and

@HaydnTrigg HaydnTrigg force-pushed the x86_x64_int3_comparison branch from d99656d to 05c1d1c Compare June 2, 2026 02:13
@encounter encounter merged commit b8d7b3b into encounter:main Jun 2, 2026
23 checks passed
@HaydnTrigg HaydnTrigg deleted the x86_x64_int3_comparison branch June 2, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants