Skip to content

Commit 66da80f

Browse files
authored
arm: Fix .word not on 4-byte boundary (#282)
1 parent 0a85f54 commit 66da80f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

objdiff-core/src/arch/arm.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,10 @@ impl Arch for ArchArm {
224224
}
225225

226226
// Check how many bytes we can/should read
227-
let num_code_bytes = if data.len() >= 4 {
227+
let num_code_bytes = if mode == unarm::ParseMode::Data {
228+
// 32-bit .word value should be aligned on a 4-byte boundary, otherwise use .hword
229+
if address & 3 == 0 { 4 } else { 2 }
230+
} else if data.len() >= 4 {
228231
// Read 4 bytes even for Thumb, as the parser will determine if it's a 2 or 4 byte instruction
229232
4
230233
} else if mode != unarm::ParseMode::Arm {

0 commit comments

Comments
 (0)