eliben / pyelftools

Parsing ELF and DWARF in Python
Other
2.03k stars 512 forks source link

Fix crash in readelf.py if a symbol doesn't define st_shndx #566

Closed berolinux closed 3 weeks ago

berolinux commented 3 months ago

symbol['st_shndx'] can take a value of 'SHN_UNDEF' -- causing a crash in readelf.py when dumping the symbol table since that non-numeric value can't be compared to self.elffile.num_sections().

Add a check before assuming st_shndx is numeric.

sevaa commented 3 months ago

I'd do a plain comparison to the string literal 'SHN_UNDEF'. But no pressure :)

sevaa commented 3 weeks ago

@eliben this was addressed by #574