Bug 13196 - readelf floating point exception
Summary: readelf floating point exception
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-17 04:08 UTC by Paul Marinescu
Modified: 2011-09-18 16:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
file to expose bug (2.45 KB, application/octet-stream)
2011-09-17 04:08 UTC, Paul Marinescu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Marinescu 2011-09-17 04:08:06 UTC
Created attachment 5935 [details]
file to expose bug

readelf 2.21.53 crashes with a division by zero when trying to display the debug aranges section of a (possibly malformed) file.

To reproduce run

readelf -wr hello.test.div

For me this results in:
Contents of the .debug_aranges section:

  Length:                   28
  Version:                  2
  Offset into .debug_info:  0x0
  Pointer Size:             0
  Segment Size:             0

    Address    Length
Floating point exception
Comment 1 H.J. Lu 2011-09-17 22:46:08 UTC
(In reply to comment #0)
> Created attachment 5935 [details]
> file to expose bug
> 
> readelf 2.21.53 crashes with a division by zero when trying to display the
> debug aranges section of a (possibly malformed) file.
> 
> To reproduce run
> 
> readelf -wr hello.test.div
> 
> For me this results in:
> Contents of the .debug_aranges section:
> 
>   Length:                   28
>   Version:                  2
>   Offset into .debug_info:  0x0
>   Pointer Size:             0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Bad input file.
Comment 2 Paul Marinescu 2011-09-17 23:37:40 UTC
Yes, I would have expected a 'Bad input file' message rather than a FP exception
Comment 3 Sourceware Commits 2011-09-18 16:50:20 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	hjl@sourceware.org	2011-09-18 16:50:17

Modified files:
	binutils       : ChangeLog dwarf.c 

Log message:
	Check zero address size.
	
	2011-09-18  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR binutils/13196
	* dwarf.c (display_debug_aranges): Check zero address size.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1827&r2=1.1828
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/dwarf.c.diff?cvsroot=src&r1=1.99&r2=1.100
Comment 4 H.J. Lu 2011-09-18 16:52:21 UTC
Fixed.