Handle binaries with corrupt section or segment headers
authorNick Clifton <nickc@redhat.com>
Thu, 14 Nov 2002 14:38:39 +0000 (14:38 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 14 Nov 2002 14:38:39 +0000 (14:38 +0000)
binutils/ChangeLog
binutils/readelf.c

index 6ceb184c3a650e18da280b4d913814eeca4026ad..bbf1d617a4a07599d064beba6ddb53dfb150e656 100644 (file)
@@ -1,3 +1,11 @@
+2002-11-14  Nick Clifton  <nickc@redhat.com>
+
+       * readelf.c (process_program_headers): Add comment about return
+       value.  Ensure that 0 is returned if the headers are not loaded.
+       (process_file): If process_section_headers failed to load the
+       headers disable any tests that rely upon them.  Similarly for
+       process_program_headers.
+
 2002-11-12  Nick Clifton  <nickc@redhat.com>
 
        * po/da.po: Updated Danish translation.
index f381e2393a248032a298cc07360378c91d324e79..cbeb05953956467a97bcf387260fa60c0c1c6b5a 100644 (file)
@@ -2886,6 +2886,8 @@ get_64bit_program_headers (file, program_headers)
   return 1;
 }
 
+/* Returns 1 if the program headers were loaded.  */
+
 static int
 process_program_headers (file)
      FILE * file;
@@ -2898,7 +2900,7 @@ process_program_headers (file)
     {
       if (do_segments)
        printf (_("\nThere are no program headers in this file.\n"));
-      return 1;
+      return 0;
     }
 
   if (do_segments && !do_header)
@@ -10053,11 +10055,18 @@ process_file (file_name)
       return 1;
     }
 
-  process_section_headers (file);
+  if (! process_section_headers (file))
+    {
+      /* Without loaded section headers we
+        cannot process lots of things.  */
+      do_unwind = do_version = do_dump = do_arch = 0;
 
-  process_program_headers (file);
+      if (! do_using_dynamic)
+       do_syms = do_reloc = 0;
+    }
 
-  process_dynamic_segment (file);
+  if (process_program_headers (file))
+    process_dynamic_segment (file);
 
   process_relocs (file);
 
This page took 0.034581 seconds and 4 git commands to generate.