This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
PATCH for BFD Dwarf debug parser
- To: binutils at sourceware dot cygnus dot com
- Subject: PATCH for BFD Dwarf debug parser
- From: Andrew Haley <aph at pasanda dot cygnus dot co dot uk>
- Date: 15 Oct 1999 12:53:08 -0000
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. */