Skip to content

Commit d92a892

Browse files
authored
Relax string size requirement for auto symbols (#102)
1 parent 5e33fea commit d92a892

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/analysis/objects.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anyhow::Result;
22

33
use crate::{
44
obj::{ObjDataKind, ObjInfo, ObjSectionKind, ObjSymbolKind, SymbolIndex},
5-
util::split::is_linker_generated_label,
5+
util::{config::is_auto_symbol, split::is_linker_generated_label},
66
};
77

88
pub fn detect_objects(obj: &mut ObjInfo) -> Result<()> {
@@ -134,15 +134,19 @@ pub fn detect_strings(obj: &mut ObjInfo) -> Result<()> {
134134
StringResult::None => {}
135135
StringResult::String { length, terminated } => {
136136
let size = if terminated { length + 1 } else { length };
137-
if !symbol.size_known || symbol.size == size as u64 {
137+
if symbol.size == size as u64
138+
|| (is_auto_symbol(symbol) && symbol.size > size as u64)
139+
{
138140
let str = String::from_utf8_lossy(&data[..length]);
139141
log::debug!("Found string '{}' @ {}", str, symbol.name);
140142
symbols_set.push((symbol_idx, ObjDataKind::String, size));
141143
}
142144
}
143145
StringResult::WString { length, str } => {
144146
let size = length + 2;
145-
if !symbol.size_known || symbol.size == size as u64 {
147+
if symbol.size == size as u64
148+
|| (is_auto_symbol(symbol) && symbol.size > size as u64)
149+
{
146150
log::debug!("Found wide string '{}' @ {}", str, symbol.name);
147151
symbols_set.push((symbol_idx, ObjDataKind::String16, size));
148152
}

0 commit comments

Comments
 (0)