PATCH for BFD Dwarf debug parser

Andrew Haley aph@pasanda.cygnus.co.uk
Fri Oct 15 05:53:00 GMT 1999


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. */



More information about the Binutils mailing list