where a section has the SEC_IN_MEMORY flag set but no actual
contents allocated.
+2009-03-27 Nick Clifton <nickc@redhat.com>
+
+ * section.c (bfd_get_section_contents): Detect and handle the case
+ where a section has the SEC_IN_MEMORY flag set but no actual
+ contents allocated.
+
2009-03-26 Alan Modra <amodra@bigpond.net.au>
PR 6494
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;
}