aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-07-30 12:52:19 +0930
committerAlan Modra <amodra@gmail.com>2021-07-30 13:15:58 +0930
commit6329d1e13eabb4463d3a459ffe4fd0f028ca37df (patch)
tree4d3f5fe2f6d00970b59237eb8ce650c275a64632 /bfd
parent602885d8087f6ab35c8b9fd8ff0d5240a0b040a0 (diff)
downloadgdb-6329d1e13eabb4463d3a459ffe4fd0f028ca37df.zip
gdb-6329d1e13eabb4463d3a459ffe4fd0f028ca37df.tar.gz
gdb-6329d1e13eabb4463d3a459ffe4fd0f028ca37df.tar.bz2
IMAGE_SCN_LNK_NRELOC_OVFL
From microsoft docs: It is an error if IMAGE_SCN_LNK_NRELOC_OVFL is set and there are fewer than 0xffff relocations in the section. * coffcode.h (coff_set_alignment_hook): Sanity check overflow reloc count.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/coffcode.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 9b8798c..d2076ef 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1951,6 +1951,12 @@ coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED,
coff_swap_reloc_in (abfd, &dst, &n);
if (bfd_seek (abfd, oldpos, 0) != 0)
return;
+ if (n.r_vaddr < 0xffff)
+ {
+ _bfd_error_handler (_("%pB: overflow reloc count too small"), abfd);
+ bfd_set_error (bfd_error_bad_value);
+ return;
+ }
section->reloc_count = hdr->s_nreloc = n.r_vaddr - 1;
section->rel_filepos += relsz;
}