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
729 stars 158 forks source link

elfio_dump.hpp bug #40

Closed ads830e closed 4 years ago

ads830e commented 4 years ago

In elfio_dump.hpp,

line611: for ( Elf_Half i = 0; i < sym_no; ++i ) { std::string name; Elf64_Addr value = 0; Elf_Xword size = 0; unsigned char bind = 0; unsigned char type = 0; Elf_Half section = 0; unsigned char other = 0; symbols.get_symbol( i, name, value, size, bind, type, section, other ); symbol_table( out, i, name, value, size, bind, type, section, reader.get_class() ); } line630: static void symbol_table( std::ostream& out, Elf_Half no, std::string& name, Elf64_Addr value, Elf_Xword size, unsigned char bind, unsigned char type, Elf_Half section, unsigned int elf_class )

If the sym count is over 65535(Elf_Half),it will never jump out from the loop, and the function "symbol_table" won't work expectly! So we should change its type to Elf_Xword?

serge1 commented 4 years ago

Thank you! Fixed in commit a935b54.