Skip to content
Snippets Groups Projects
Commit 695a05dc authored by Semi Malinen's avatar Semi Malinen
Browse files

Do not index past the end of the chain table

parent b830e5e4
Branches
Tags
No related merge requests found
...@@ -88,13 +88,15 @@ class symbol_section_accessor ...@@ -88,13 +88,15 @@ class symbol_section_accessor
if ( 0 != get_hash_table_index() ) { if ( 0 != get_hash_table_index() ) {
Elf_Word nbucket = *(Elf_Word*)hash_section->get_data(); Elf_Word nbucket = *(Elf_Word*)hash_section->get_data();
Elf_Word nchain = *(Elf_Word*)( hash_section->get_data() +
sizeof( Elf_Word ) );
Elf_Word val = elf_hash( (const unsigned char*)name.c_str() ); Elf_Word val = elf_hash( (const unsigned char*)name.c_str() );
Elf_Word y = *(Elf_Word*)( hash_section->get_data() + Elf_Word y = *(Elf_Word*)( hash_section->get_data() +
( 2 + val % nbucket ) * sizeof( Elf_Word ) ); ( 2 + val % nbucket ) * sizeof( Elf_Word ) );
std::string str; std::string str;
get_symbol( y, str, value, size, bind, type, section_index, other ); get_symbol( y, str, value, size, bind, type, section_index, other );
while ( str != name && STN_UNDEF != y ) { while ( str != name && STN_UNDEF != y && y < nchain ) {
y = *(Elf_Word*)( hash_section->get_data() + y = *(Elf_Word*)( hash_section->get_data() +
( 2 + nbucket + y ) * sizeof( Elf_Word ) ); ( 2 + nbucket + y ) * sizeof( Elf_Word ) );
get_symbol( y, str, value, size, bind, type, section_index, other ); get_symbol( y, str, value, size, bind, type, section_index, other );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment