* dwarf2read.c (follow_die_ref): Add comment.
[deliverable/binutils-gdb.git] / bfd / section.c
index 5a335a62909ad67754c3d6c6763302b5bf2f01a2..dc8225f39d3329997b32dba497ef54c086078ef9 100644 (file)
@@ -1436,6 +1436,16 @@ bfd_get_section_contents (bfd *abfd,
 
   if ((section->flags & SEC_IN_MEMORY) != 0)
     {
+      if (section->contents == NULL)
+       {
+         /* This can happen because of errors earlier on in the linking process.
+            We do not want to seg-fault here, so clear the flag and return an
+            error code.  */
+         section->flags &= ~ SEC_IN_MEMORY;
+         bfd_set_error (bfd_error_invalid_operation);
+         return FALSE;
+       }
+      
       memcpy (location, section->contents + offset, (size_t) count);
       return TRUE;
     }
This page took 0.025177 seconds and 4 git commands to generate.