From: Nick Clifton Date: Fri, 9 Feb 2018 09:28:45 +0000 (+0000) Subject: Import patch from mainline to fix possible seg-fault whilst parsing corrupt ELF notes... X-Git-Tag: users/ARM/embedded-binutils-2_30-branch-2018q2~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d895ef77ffc94e02e748856c2ab54f5bb8cc867e;p=thirdparty%2Fbinutils-gdb.git Import patch from mainline to fix possible seg-fault whilst parsing corrupt ELF notes with extravagent alignments. PR 22788 * elf.c (elf_parse_notes): Reject notes with excessuively large alignments. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bff61588346..3cf95781832 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2018-02-09 Nick Clifton + + Import patch from mainline: + 2018-02-08 Nick Clifton + + PR 22788 + * elf.c (elf_parse_notes): Reject notes with excessuively large + alignments. + 2018-02-07 Alan Modra Revert 2018-01-17 Alan Modra diff --git a/bfd/elf.c b/bfd/elf.c index 90aef091329..c1320985580 100644 --- 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)