Skip to content

Commit 914e076

Browse files
authored
Fix a crash related to ElfParser::loadSymbolTable (#191) (#192)
1 parent cc98924 commit 914e076

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

ddprof-lib/src/main/cpp/symbols_linux.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,11 @@ void ElfParser::loadSymbolTable(const char *symbols, size_t total_size,
353353
symbols += ent_size) {
354354
ElfSymbol *sym = (ElfSymbol *)symbols;
355355
if (sym->st_name != 0 && sym->st_value != 0) {
356-
// sanity check the offsets not to exceed the file size
357-
if (_length == 0 || (sym->st_name < _length && sym->st_value < _length)) {
358-
// Skip special AArch64 mapping symbols: $x and $d
359-
if (sym->st_size != 0 || sym->st_info != 0 ||
360-
strings[sym->st_name] != '$') {
361-
_cc->add(_base + sym->st_value, (int)sym->st_size,
362-
strings + sym->st_name);
363-
}
356+
// Skip special AArch64 mapping symbols: $x and $d
357+
if (sym->st_size != 0 || sym->st_info != 0 ||
358+
strings[sym->st_name] != '$') {
359+
_cc->add(_base + sym->st_value, (int)sym->st_size,
360+
strings + sym->st_name);
364361
}
365362
}
366363
}

0 commit comments

Comments
 (0)