mirror of
https://github.com/serge1/ELFIO.git
synced 2025-01-01 08:59:21 +00:00
Do not index past the end of the chain table
This commit is contained in:
parent
b830e5e452
commit
695a05dc5d
@ -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 );
|
||||||
|
Loading…
Reference in New Issue
Block a user