This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
question about dwarf.c
- From: Tom Tromey <tromey at redhat dot com>
- To: Binutils Development <binutils at sourceware dot org>
- Date: Thu, 12 Aug 2010 11:34:25 -0600
- Subject: question about dwarf.c
I recently happened across an object with non-zero LMA and VMAs for the
.debug_info section. Trying to dump this section with "readelf -wi"
caused readelf to crash.
The crash occurs because the call to process_abbrev_section subtracts
out the section address, thus passing an invalid pointer to
process_abbrev_section.
Can someone explain the reason for this? I don't understand it.
FWIW, the appended patch stops the crash for me.
Tom
*** dwarf.c.~1.71.~ 2010-08-05 10:17:53.000000000 -0600
--- dwarf.c 2010-08-12 11:28:53.000000000 -0600
***************
*** 2078,2084 ****
process_abbrev_section
((unsigned char *) debug_displays [abbrev_sec].section.start
+ compunit.cu_abbrev_offset
! - debug_displays [abbrev_sec].section.address,
(unsigned char *) debug_displays [abbrev_sec].section.start
+ debug_displays [abbrev_sec].section.size);
--- 2078,2084 ----
process_abbrev_section
((unsigned char *) debug_displays [abbrev_sec].section.start
+ compunit.cu_abbrev_offset
! /* - debug_displays [abbrev_sec].section.address */,
(unsigned char *) debug_displays [abbrev_sec].section.start
+ debug_displays [abbrev_sec].section.size);