mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-11 14:41:51 +00:00
arm: Fix .word reading 4 bytes when less than 4 remain (#285)
This commit is contained in:
@@ -224,12 +224,14 @@ impl Arch for ArchArm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check how many bytes we can/should read
|
// Check how many bytes we can/should read
|
||||||
let num_code_bytes = if mode == unarm::ParseMode::Data {
|
let num_code_bytes = if data.len() >= 4 {
|
||||||
// 32-bit .word value should be aligned on a 4-byte boundary, otherwise use .hword
|
if mode == unarm::ParseMode::Data && address & 3 != 0 {
|
||||||
if address & 3 == 0 { 4 } else { 2 }
|
// 32-bit .word value should be aligned on a 4-byte boundary, otherwise use .hword
|
||||||
} else if data.len() >= 4 {
|
2
|
||||||
// Read 4 bytes even for Thumb, as the parser will determine if it's a 2 or 4 byte instruction
|
} else {
|
||||||
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 {
|
} else if mode != unarm::ParseMode::Arm {
|
||||||
2
|
2
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user