serge1 / ELFIO

ELFIO - ELF (Executable and Linkable Format) reader and producer implemented as a header only C++ library
http://serge1.github.io/ELFIO
MIT License
706 stars 152 forks source link

Update elfio_symbols.hpp #90

Closed y27988 closed 2 years ago

y27988 commented 2 years ago

if the section header is bad, return 0 when get symbol num

serge1 commented 2 years ago

I get compilation errors when applying the PR. Please fix.

/home/runner/work/ELFIO/ELFIO/elfio/elfio_symbols.hpp: In instantiation of ‘ELFIO::Elf_Xword 
ELFIO::symbol_section_accessor_template<S>::get_symbols_num() const [with S = ELFIO::section; ELFIO::Elf_Xword = long 
unsigned int]’:
/home/runner/work/ELFIO/ELFIO/elfio/elfio_dump.hpp:822:60:   required from here
/home/runner/work/ELFIO/ELFIO/elfio/elfio_symbols.hpp:46:59: error: ‘class ELFIO::section’ has no member named 
‘get_stream_size’; did you mean ‘get_entry_size’?
   46 |              symbol_section->get_size() < symbol_section->get_stream_size() ) {
      |                                           ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      |                                           get_entry_size
make[2]: *** [examples/elfdump/CMakeFiles/elfdump.dir/build.make:76: 
examples/elfdump/CMakeFiles/elfdump.dir/elfdump.cpp.o] Error 1