This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_30-branch] Import patch from mainline to fix possible seg-fault whilst parsing corrupt ELF notes with extravage


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d895ef77ffc94e02e748856c2ab54f5bb8cc867e

commit d895ef77ffc94e02e748856c2ab54f5bb8cc867e
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Feb 9 09:28:45 2018 +0000

    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:
---
 bfd/ChangeLog | 9 +++++++++
 bfd/elf.c     | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bff6158..3cf9578 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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>
diff --git a/bfd/elf.c b/bfd/elf.c
index 90aef09..c132098 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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]