PR23804, buffer overflow in sec_merge_hash_lookup
authorAlan Modra <amodra@gmail.com>
Tue, 23 Oct 2018 07:59:24 +0000 (18:29 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 23 Oct 2018 10:39:09 +0000 (21:09 +1030)
PR 23804
* merge.c (_bfd_add_merge_section): Don't attempt to merge
sections where size is not a multiple of entsize.

bfd/ChangeLog
bfd/merge.c

index 31ff3d6db43a7d830a8a7ac64db3ab639bf0be96..da423b14763565c83169a0e3f0401b6e7d5d06b7 100644 (file)
@@ -1,3 +1,9 @@
+2018-10-23  Alan Modra  <amodra@gmail.com>
+
+       PR 23804
+       * merge.c (_bfd_add_merge_section): Don't attempt to merge
+       sections where size is not a multiple of entsize.
+
 2018-10-20  Alan Modra  <amodra@gmail.com>
 
        PR 23788
index 790455294276b0e82e8234b2098290d00d036bb3..5e3bba09825f7680ea67ef56ffa5370f3d267d01 100644 (file)
@@ -376,6 +376,9 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec,
       || sec->entsize == 0)
     return TRUE;
 
+  if (sec->size % sec->entsize != 0)
+    return TRUE;
+
   if ((sec->flags & SEC_RELOC) != 0)
     {
       /* We aren't prepared to handle relocations in merged sections.  */
This page took 0.028693 seconds and 4 git commands to generate.