Unwrap code section in arm.rs

This commit is contained in:
Aetias 2024-05-23 16:49:38 +02:00
parent 0f9dd7ed41
commit 71de77681c

View File

@ -1,6 +1,6 @@
use std::{borrow::Cow, collections::HashMap};
use anyhow::{bail, Result};
use anyhow::{anyhow, bail, Result};
use armv5te::{arm, thumb};
use object::{
elf, File, Object, ObjectSection, ObjectSymbol, Relocation, RelocationFlags, SectionIndex,
@ -51,6 +51,7 @@ impl ObjArch for ObjArchArm {
config: &DiffObjConfig,
) -> Result<ProcessCodeResult> {
let (section, symbol) = obj.section_symbol(symbol_ref);
let section = section.ok_or_else(|| anyhow!("Code symbol section not found"))?;
let mut code = &section.data
[symbol.section_address as usize..(symbol.section_address + symbol.size) as usize];