Bug 127597 - readelf: Floating point exception
Summary: readelf: Floating point exception
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: 2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-07-10 03:59 UTC by John Reiser
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-25 14:52:17 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description John Reiser 2004-07-10 03:59:54 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2)
Gecko/20040301

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):
binutils-2.15.90.0.3-5

How reproducible:
Always

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.
2.
3.
    

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:

binutils/readelf.c:
5764              printf (_("\nSymbol table '%s' contains %lu
entries:\n"),
5765                      SECTION_NAME (section),
5766                      (unsigned long) (section->sh_size /
section->sh_entsize));

Comment 1 Jakub Jelinek 2004-10-25 14:52:17 UTC
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.