Red Hat Bugzilla – Bug 127597
readelf: Floating point exception
Last modified: 2007-11-30 17:10:45 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2)
Description of problem:
readelf divides by zero when Elf32_Shdr.sh_entsize is 0 for a .symtab
section; the result is termination by Floating point exception. Yes,
such input is malformed. However, a diagnostic program such as
readelf should check for such things and give a good error message.
Aborting due to signal is poor practice.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Take a known-good ET_REL file with a symbol table, binary edit the
.sh_entsize for the .symtab section to be 0, and run "readelf
--symbols" on the file.
Actual Results: Floating point exception (SIGFPE)
Expected Results: A nice diagnostic such as:
readelf: 0==.sh_entsize for .symtab (section NN)
and then acting as if 1==.sh_entsize (no floating point exception).
5764 printf (_("\nSymbol table '%s' contains %lu
5765 SECTION_NAME (section),
5766 (unsigned long) (section->sh_size /
There are many places, not just one, in more than one tool that rely
that some fields aren't really bogus.
If you want this changed, submit patches upstream, I don't think
this is severe enough to require working on it.