From 7a1db4060fb7605364d686ff94d6705436f7c8c8 Mon Sep 17 00:00:00 2001 From: y27988 <42593525+y27988@users.noreply.github.com> Date: Tue, 11 Jan 2022 15:52:45 +0800 Subject: [PATCH] Update elfio_symbols.hpp if the section header is bad, return 0 when get symbol num --- elfio/elfio_symbols.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elfio/elfio_symbols.hpp b/elfio/elfio_symbols.hpp index 685a004..c56e23e 100644 --- a/elfio/elfio_symbols.hpp +++ b/elfio/elfio_symbols.hpp @@ -42,7 +42,8 @@ template 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(); }