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]
Other format: [Raw text]

Re: [PATCH] fix segfault on copying some PEs


On Sun, Aug 03, 2003 at 03:53:39PM -0400, Jeff Muizelaar wrote:
>It seems some PEs have ptr's to line number tables that don't exist. 

That is true.  It's annoying.

>Currently we blindly assume that they are valid invalid ones cause a 
>segfault. The attached patch prints a warning and skips the missing table.

This seems ok to me but I'd be comfortable with just returning without a
warning.  We silently ignore this type of thing in gdb.

I wonder if this should be conditionalized for Windows, too.  I assume that
regular COFF targets don't do this.

cgf

>2003-08-03  Jeff Muizelaar  <muizelaar@rogers.com>
>
>	* coffcode.h: (coff_slurp_line_table) fix read error causing segfault.

>diff -urN binutils-030713/bfd/coffcode.h binutils-virgin-slurp-line-fix/bfd/coffcode.h
>--- binutils-030713/bfd/coffcode.h	2003-07-12 06:55:05.000000000 -0400
>+++ binutils-virgin-slurp-line-fix/bfd/coffcode.h	2003-08-03 11:37:34.000000000 -0400
>@@ -4409,7 +4409,14 @@
>   native_lineno = (LINENO *) buy_and_read (abfd, asect->line_filepos, amt);
>   amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
>   lineno_cache = (alent *) bfd_alloc (abfd, amt);
>-  if (lineno_cache == NULL)
>+  if (native_lineno == NULL)
>+    {
>+       (*_bfd_error_handler)
>+         (_("%s: warning: line number table read failed"),
>+	  bfd_archive_filename (abfd));
>+       return FALSE;
>+    }
>+  else if (lineno_cache == NULL)
>     return FALSE;
>   else
>     {


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