This is the mail archive of the binutils@sourceware.cygnus.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]

PATCH for BFD Dwarf debug parser


If ever a Dwarf die is of zero length (if, for example, the file is
corrupt) the linker will hang forever re-reading the input.  This
patch adds robustness.

Andrew.

1999-10-15  Andrew Haley  <aph@cygnus.com>

	* dwarf1.c (parse_die): Fail to parse a die if its length is zero.

Index: dwarf1.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/dwarf1.c,v
retrieving revision 1.1
diff -p -r1.1 dwarf1.c
*** dwarf1.c	1998/10/05 16:07:44	1.1
--- dwarf1.c	1999/10/15 12:45:01
*************** parse_die (abfd, aDieInfo, aDiePtr)
*** 186,191 ****
--- 186,193 ----
    /* First comes the length. */
    aDieInfo->length = bfd_get_32 (abfd, xptr);
    xptr += 4;
+   if (aDieInfo->length == 0)
+     return false;
    if (aDieInfo->length < 6)
      {
        /* Just padding bytes. */


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