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]

PATCH: handle address overflow in objdump disassembly


Hi,

the addresses of a section located at the end of the address space are not correctly displayed:

fffc0368:	38 21 00 10 	addi    r1,r1,16
fffc036c:	4e 80 00 20 	blr
Disassembly of section .reset:

fffffffc <_reset>:
fffc:	4b fc 00 4c 	b       fffc0048 <_start>


This is due to an overflow in objdump.c(disassemble_bytes). This patch fixes this issue:


fffc0368:	38 21 00 10 	addi    r1,r1,16
fffc036c:	4e 80 00 20 	blr

Disassembly of section .reset:

fffffffc <_reset>:
fffffffc:	4b fc 00 4c 	b       fffc0048 <_start>

Tested on x86_64 - no regression.

Tristan.

binutils:
2008-11-06  Tristan Gingold  <gingold@adacore.com>

	* objdump.c (disassemble_bytes): Do not skip leadin zero in case of
	overflow.

*** binutils/objdump.c	28 Aug 2008 16:05:03 -0000	1.146
--- binutils/objdump.c	6 Nov 2008 15:36:42 -0000
***************
*** 1378,1389 ****
  	(aux->abfd, buf,
  	 (section->vma
  	  + bfd_section_size (section->owner, section) / opb));
!       s = buf;
!       while (s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0'
! 	     && s[4] == '0')
! 	{
! 	  skip_addr_chars += 4;
! 	  s += 4;
  	}
      }

--- 1378,1397 ----
  	(aux->abfd, buf,
  	 (section->vma
  	  + bfd_section_size (section->owner, section) / opb));
!       for (s = buf;
! 	   s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0';
! 	   s += 4)
! 	{
! 	  if (s[4] == '0')
! 	    skip_addr_chars += 4;
! 	  else if (s[4] == '\0' && section->vma != 0)
! 	    {
! 	      /* In case of overflow, don't discard zeros.  */
! 	      skip_addr_chars = 0;
! 	      break;
! 	    }
! 	  else
! 	    break;
  	}
      }


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