Update elfio_symbols.hpp

if the section header is bad, return 0 when get symbol num
This commit is contained in:
y27988 2022-01-11 15:52:45 +08:00 committed by Serge Lamikhov-Center
parent 69fc128bd5
commit 7a1db4060f

View File

@ -42,7 +42,8 @@ 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() ) {
if ( 0 != symbol_section->get_entry_size() &&
symbol_section->get_size() < symbol_section->get_stream_size() ) {
nRet =
symbol_section->get_size() / symbol_section->get_entry_size();
}