From 70f5905e672425f31d6c51f4565b6ddddbf3a4d3 Mon Sep 17 00:00:00 2001 From: pjht Date: Sat, 9 Mar 2024 12:25:55 -0600 Subject: [PATCH] Fail gracefully on symbols with an invalid section name --- src/symbol_table.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/symbol_table.rs b/src/symbol_table.rs index 26cabbc..f88dd2a 100644 --- a/src/symbol_table.rs +++ b/src/symbol_table.rs @@ -73,7 +73,7 @@ impl SymbolTable { .map(|sym| { ( 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::>();