Skip to content
Snippets Groups Projects
Commit a059a11c authored by Vivek Das Mohapatra's avatar Vivek Das Mohapatra
Browse files

Fix a potential segfault in the ELF memory dumper

The symtab address may or may not have been adjusted by the runtime
linker after being mapped into memory, so we need to use fix_addr to
make sure we don't try to deref an offset instead of the actual address.
parent d5103ecc
Branches
Tags
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
...@@ -897,7 +897,7 @@ dump_dynamic (const char *indent, void *start, size_t size, ElfW(Addr) base) ...@@ -897,7 +897,7 @@ dump_dynamic (const char *indent, void *start, size_t size, ElfW(Addr) base)
verdef = (const void *) find_ptr( base, start, DT_VERDEF ); verdef = (const void *) find_ptr( base, start, DT_VERDEF );
if( verdefnum == -1 ) if( verdefnum == -1 )
verdefnum = find_value( base, start, DT_VERDEFNUM ); verdefnum = find_value( base, start, DT_VERDEFNUM );
symtab = (const void *) entry->d_un.d_ptr; symtab = fix_addr( (void *) base, entry->d_un.d_ptr );
dump_symtab( indent, symtab, strtab, versym, verdef, verdefnum ); dump_symtab( indent, symtab, strtab, versym, verdef, verdefnum );
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment