From 66da80ff6910b332c0f5702c653b95c9c803ec35 Mon Sep 17 00:00:00 2001 From: Aetias <144526980+AetiasHax@users.noreply.github.com> Date: Wed, 19 Nov 2025 05:55:40 +0100 Subject: [PATCH] arm: Fix .word not on 4-byte boundary (#282) --- objdiff-core/src/arch/arm.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/objdiff-core/src/arch/arm.rs b/objdiff-core/src/arch/arm.rs index 930fc59..2640ae8 100644 --- a/objdiff-core/src/arch/arm.rs +++ b/objdiff-core/src/arch/arm.rs @@ -224,7 +224,10 @@ impl Arch for ArchArm { } // Check how many bytes we can/should read - let num_code_bytes = if data.len() >= 4 { + let num_code_bytes = if mode == unarm::ParseMode::Data { + // 32-bit .word value should be aligned on a 4-byte boundary, otherwise use .hword + if address & 3 == 0 { 4 } else { 2 } + } else if data.len() >= 4 { // Read 4 bytes even for Thumb, as the parser will determine if it's a 2 or 4 byte instruction 4 } else if mode != unarm::ParseMode::Arm {