Fail gracefully on symbols with an invalid section name

This commit is contained in:
pjht 2024-03-09 12:25:55 -06:00
parent 8c6e26005d
commit 70f5905e67
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A

View File

@ -73,7 +73,7 @@ impl SymbolTable {
.map(|sym| { .map(|sym| {
( (
symstrtab.get(sym.st_name as usize).unwrap().to_string(), symstrtab.get(sym.st_name as usize).unwrap().to_string(),
Symbol::new(&sym, sect_names[sym.st_shndx as usize].to_string()), Symbol::new(&sym, sect_names.get(sym.st_shndx as usize).map_or_else(|| "UNKNOWN".to_string(), |x| x.to_string())),
) )
}) })
.collect::<HashMap<_, _>>(); .collect::<HashMap<_, _>>();