]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Import patch from mainline to fix possible seg-fault whilst parsing corrupt ELF notes...
authorNick Clifton <nickc@redhat.com>
Fri, 9 Feb 2018 09:28:45 +0000 (09:28 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 9 Feb 2018 09:28:45 +0000 (09:28 +0000)
PR 22788
* elf.c (elf_parse_notes): Reject notes with excessuively large
alignments.

bfd/ChangeLog
bfd/elf.c

index bff61588346fae63e6036aaae959b4ce2cb34c47..3cf9578183202613fe0c3f7cd1519f678ea1d5f2 100644 (file)
@@ -1,3 +1,12 @@
+2018-02-09  Nick Clifton  <nickc@redhat.com>
+
+       Import patch from mainline:
+       2018-02-08  Nick Clifton  <nickc@redhat.com>
+
+       PR 22788
+       * elf.c (elf_parse_notes): Reject notes with excessuively large
+       alignments.
+
 2018-02-07  Alan Modra  <amodra@gmail.com>
 
        Revert 2018-01-17  Alan Modra  <amodra@gmail.com>
index 90aef0913292f1760264c72867b8c872527b4d8f..c132098558038ac1406f8fa31b8dc054e655afa1 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -11019,6 +11019,8 @@ elf_parse_notes (bfd *abfd, char *buf, size_t size, file_ptr offset,
      align is less than 4, we use 4 byte alignment.   */
   if (align < 4)
     align = 4;
+  if (align != 4 && align != 8)
+    return FALSE;
 
   p = buf;
   while (p < buf + size)