diff --git a/objdiff-core/src/arch/mod.rs b/objdiff-core/src/arch/mod.rs index 7111341..0879fb2 100644 --- a/objdiff-core/src/arch/mod.rs +++ b/objdiff-core/src/arch/mod.rs @@ -34,9 +34,12 @@ pub enum DataType { impl DataType { pub fn display_bytes(&self, bytes: &[u8]) -> Option { - if self.required_len().is_some_and(|l| bytes.len() < l) { + let Some(required_len) = self.required_len() else { return None; - } + }; + // TODO: For symbols larger than their data type, we should probably support + // using the relocation's relative offset to read the bytes. + let bytes = bytes.get(0..required_len)?; match self { DataType::Int8 => {