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]

[PATCH] fix segfault on copying some PEs


It seems some PEs have ptr's to line number tables that don't exist. Currently we blindly assume that they are valid invalid ones cause a segfault. The attached patch prints a warning and skips the missing table.

-Jeff
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]