Fix address violation issues encountered when parsing corrupt binaries.
[binutils-gdb.git] / bfd / section.c
index 28eee7f8b3ca9eeddfa17b08e139b4f5a2164c38..811d42a0d026dabd7c547a74fdd256fb8003c75d 100644 (file)
@@ -1240,7 +1240,7 @@ bfd_make_section_with_flags (bfd *abfd, const char *name,
   struct section_hash_entry *sh;
   asection *newsect;
 
-  if (abfd->output_has_begun)
+  if (abfd == NULL || name == NULL || abfd->output_has_begun)
     {
       bfd_set_error (bfd_error_invalid_operation);
       return NULL;