/* rescoff.c -- read and write resources in Windows COFF files.
- Copyright (C) 1997-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2020 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
Rewritten by Kai Tietz, Onevision.
}
set_windres_bfd (&wrbfd, abfd, sec, WR_KIND_BFD);
- size = bfd_section_size (abfd, sec);
+ size = bfd_section_size (sec);
/* PR 17512: file: 1b25ba5d
The call to get_file_size here may be expensive
but there is no other way to determine if the section size
flaginfo.filename = filename;
flaginfo.data = data;
flaginfo.data_end = data + size;
- flaginfo.secaddr = (bfd_get_section_vma (abfd, sec)
- - pe_data (abfd)->pe_opthdr.ImageBase);
+ flaginfo.secaddr = (bfd_section_vma (sec)
+ - pe_data (abfd)->pe_opthdr.ImageBase);
/* Now just read in the top level resource directory. Note that we
don't free data, since we create resource entries that point into
this will have to be cleaned up. */
ret = read_coff_res_dir (&wrbfd, data, &flaginfo, (const rc_res_id *) NULL, 0);
-
+
bfd_close (abfd);
return ret;
for (j = 0; j < length; j++)
{
/* PR 17512: file: 05dc4a16. */
- if (length < 0 || ers >= (bfd_byte *) ere || ers + j * 2 + 4 >= (bfd_byte *) ere)
+ if (length < 0 || ers >= flaginfo->data_end || ers + j * 2 + 4 >= flaginfo->data_end)
overrun (flaginfo, _("resource name"));
re->id.u.n.name[j] = windres_get_16 (wrbfd, ers + j * 2 + 2, 2);
}
+ cwi.dataentsize
+ cwi.resources.length);
- if (! bfd_set_section_size (abfd, sec, length))
+ if (!bfd_set_section_size (sec, length))
bfd_fatal ("bfd_set_section_size");
bfd_set_reloc (abfd, sec, cwi.relocs, cwi.reloc_count);