This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]