This is the mail archive of the binutils@sources.redhat.com 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]

readelf .debug_line fix


info.li_length is a bfd_vma; the size of the external length field
is exactly 4.  Thus using sizeof is incorrect, and in fact results
in garbage on Alpha.


r~


        * readelf.c (display_debug_lines): Fix section length check
        and end_of_sequence computation.

Index: readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.70
diff -c -p -d -r1.70 readelf.c
*** readelf.c	2000/11/05 19:18:34	1.70
--- readelf.c	2000/11/17 08:27:35
*************** display_debug_lines (section, start, fil
*** 5005,5011 ****
  
        /* Check the length of the block.  */
        info.li_length = BYTE_GET (external->li_length);
!       if (info.li_length > section->sh_size)
  	{
  	  warn
  	    (_("The line info appears to be corrupt - the section is too small\n"));
--- 5005,5011 ----
  
        /* Check the length of the block.  */
        info.li_length = BYTE_GET (external->li_length);
!       if (info.li_length + 4 > section->sh_size)
  	{
  	  warn
  	    (_("The line info appears to be corrupt - the section is too small\n"));
*************** display_debug_lines (section, start, fil
*** 5040,5046 ****
        printf (_("  Line Range:                  %d\n"), info.li_line_range);
        printf (_("  Opcode Base:                 %d\n"), info.li_opcode_base);
  
!       end_of_sequence = data + info.li_length + sizeof (info.li_length);
  
        reset_state_machine (info.li_default_is_stmt);
  
--- 5040,5046 ----
        printf (_("  Line Range:                  %d\n"), info.li_line_range);
        printf (_("  Opcode Base:                 %d\n"), info.li_opcode_base);
  
!       end_of_sequence = data + info.li_length + 4;
  
        reset_state_machine (info.li_default_is_stmt);
  

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