mirror of
https://github.com/serge1/ELFIO.git
synced 2024-12-26 18:15:40 +00:00
Reject ELF files with section entries smaller than symbol size
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
This commit is contained in:
parent
3e6809cf13
commit
fc3c397dd0
@ -42,7 +42,19 @@ template <class S> class symbol_section_accessor_template
|
||||
Elf_Xword get_symbols_num() const
|
||||
{
|
||||
Elf_Xword nRet = 0;
|
||||
if ( 0 != symbol_section->get_entry_size() &&
|
||||
size_t minimum_symbol_size;
|
||||
switch ( elf_file.get_class() ) {
|
||||
case ELFCLASS32:
|
||||
minimum_symbol_size = sizeof(Elf32_Sym);
|
||||
break;
|
||||
case ELFCLASS64:
|
||||
minimum_symbol_size = sizeof(Elf64_Sym);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( symbol_section->get_entry_size() >= minimum_symbol_size &&
|
||||
symbol_section->get_size() <= symbol_section->get_stream_size() ) {
|
||||
nRet =
|
||||
symbol_section->get_size() / symbol_section->get_entry_size();
|
||||
|
Loading…
Reference in New Issue
Block a user