aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/CVE-2017-8397.patch
blob: f966c80c4ead83403bee0ec13bc034422138b75f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
commit 04b31182bf3f8a1a76e995bdfaaaab4c009b9cb2
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Apr 26 16:30:22 2017 +0100

    Fix a seg-fault when processing a corrupt binary containing reloc(s) with negative addresses.
    
    	PR binutils/21434
    	* reloc.c (bfd_perform_relocation): Check for a negative address
    	in the reloc.

Upstream-Status: Backport

CVE: CVE-2017-8397
Signed-off-by: Thiruvadi Rajaraman <trajaraman@mvista.com>



Index: git/bfd/reloc.c
===================================================================
--- git.orig/bfd/reloc.c	2017-09-04 18:06:00.651987605 +0530
+++ git/bfd/reloc.c	2017-09-04 18:06:10.740066291 +0530
@@ -623,7 +623,10 @@
      PR 17512: file: c146ab8b, 46dff27f, 38e53ebf.  */
   octets = reloc_entry->address * bfd_octets_per_byte (abfd);
   if (octets + bfd_get_reloc_size (howto)
-      > bfd_get_section_limit_octets (abfd, input_section))
+      > bfd_get_section_limit_octets (abfd, input_section)
+      /* Check for an overly large offset which
+	 masquerades as a negative value too.  */
+      || (octets + bfd_get_reloc_size (howto) < bfd_get_reloc_size (howto)))
     return bfd_reloc_outofrange;
 
   /* Work out which section the relocation is targeted at and the
Index: git/bfd/ChangeLog
===================================================================
--- git.orig/bfd/ChangeLog	2017-09-04 18:06:10.684065855 +0530
+++ git/bfd/ChangeLog	2017-09-04 18:08:33.845183050 +0530
@@ -75,6 +75,12 @@
 
 2017-04-26  Nick Clifton  <nickc@redhat.com>
 
+       PR binutils/21434
+       * reloc.c (bfd_perform_relocation): Check for a negative address
+       in the reloc.
+
+2017-04-26  Nick Clifton  <nickc@redhat.com>
+
        PR binutils/21431
        * compress.c (bfd_init_section_compress_status): Check the return
        value from bfd_malloc.