+2020-08-26 Alan Modra <amodra@gmail.com>
+
+ PR 26412
+ * objcopy.c (copy_object): Don't fwrite NULL contents.
+
2020-08-26 Katayama Hirofumi <katayama.hirofumi.mz@gmail.com>
PR 26340
}
bfd_size_type size = bfd_section_size (osec);
- /* Note - we allow the dumping of zero-sized sections. */
+ /* Note - we allow the dumping of zero-sized sections,
+ creating an empty file. */
f = fopen (pdump->filename, FOPEN_WB);
if (f == NULL)
if (bfd_malloc_and_get_section (ibfd, osec, &contents))
{
- if (fwrite (contents, 1, size, f) != size)
+ if (size != 0 && fwrite (contents, 1, size, f) != size)
{
non_fatal (_("error writing section contents to %s (error: %s)"),
pdump->filename,