Bug 127597 - readelf: Floating point exception
readelf: Floating point exception
Product: Fedora
Classification: Fedora
Component: binutils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2004-07-09 23:59 EDT by John Reiser
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-25 10:52:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description John Reiser 2004-07-09 23:59:54 EDT
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):

How reproducible:

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).

Additional info:

5764              printf (_("\nSymbol table '%s' contains %lu
5765                      SECTION_NAME (section),
5766                      (unsigned long) (section->sh_size /
Comment 1 Jakub Jelinek 2004-10-25 10:52:17 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.