]> code.ossystems Code Review - openembedded-core.git/commitdiff
binutils: CVE-2017-8395
authorThiruvadi Rajaraman <trajaraman@mvista.com>
Mon, 4 Sep 2017 13:01:38 +0000 (18:31 +0530)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 7 Jan 2018 17:09:45 +0000 (17:09 +0000)
Source: git://sourceware.org/git/binutils-gdb.git
MR: 74153
Type: Security Fix
Disposition: Backport from binutils-2_29
ChangeID: 27dce214c561f9ae6f874990432f9d76a7de29d4
Description:

    Fix seg-fault attempting to compress a debug section in a corrupt binary.

        PR binutils/21431
        * compress.c (bfd_init_section_compress_status): Check the return
        value from bfd_malloc.

Affects: <= 2.29

Author: Nick Clifton <nickc@redhat.com>
Signed-off-by: Thiruvadi Rajaraman <trajaraman@mvista.com>
Reviewed-by: Armin Kuster <akuster@mvista.com>
Signed-off-by: Armin Kuster <akuster@mvista.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
meta/recipes-devtools/binutils/binutils-2.27.inc
meta/recipes-devtools/binutils/binutils/CVE-2017-8395.patch [new file with mode: 0644]

index 447de53946b8710bfb53da91b2b066c2870bd0ee..ecb0cdf094707ce4718c4b885c41d1a11fd54347 100644 (file)
@@ -68,6 +68,7 @@ SRC_URI = "\
      file://CVE-2017-7303.patch \
      file://CVE-2017-7304.patch \
      file://CVE-2017-8393.patch \
+     file://CVE-2017-8395.patch \
 "
 S  = "${WORKDIR}/git"
 
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-8395.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-8395.patch
new file mode 100644 (file)
index 0000000..42793e1
--- /dev/null
@@ -0,0 +1,72 @@
+commit e63d123268f23a4cbc45ee55fb6dbc7d84729da3
+Author: Nick Clifton <nickc@redhat.com>
+Date:   Wed Apr 26 13:07:49 2017 +0100
+
+    Fix seg-fault attempting to compress a debug section in a corrupt binary.
+    
+       PR binutils/21431
+       * compress.c (bfd_init_section_compress_status): Check the return
+       value from bfd_malloc.
+
+Upstream-Status: Backport
+
+CVE: CVE-2017-8395
+Signed-off-by: Thiruvadi Rajaraman <trajaraman@mvista.com>
+
+Index: git/bfd/compress.c
+===================================================================
+--- git.orig/bfd/compress.c    2017-09-04 17:55:00.546577566 +0530
++++ git/bfd/compress.c 2017-09-04 17:55:10.770664577 +0530
+@@ -534,7 +534,6 @@
+ {
+   bfd_size_type uncompressed_size;
+   bfd_byte *uncompressed_buffer;
+-  bfd_boolean ret;
+   /* Error if not opened for read.  */
+   if (abfd->direction != read_direction
+@@ -550,18 +549,18 @@
+   /* Read in the full section contents and compress it.  */
+   uncompressed_size = sec->size;
+   uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
++  /* PR 21431 */
++  if (uncompressed_buffer == NULL)
++    return FALSE;
++
+   if (!bfd_get_section_contents (abfd, sec, uncompressed_buffer,
+                                0, uncompressed_size))
+-    ret = FALSE;
+-  else
+-    {
+-      uncompressed_size = bfd_compress_section_contents (abfd, sec,
+-                                                       uncompressed_buffer,
+-                                                       uncompressed_size);
+-      ret = uncompressed_size != 0;
+-    }
++    return FALSE;
+-  return ret;
++  uncompressed_size = bfd_compress_section_contents (abfd, sec,
++                                                   uncompressed_buffer,
++                                                   uncompressed_size);
++  return uncompressed_size != 0;
+ }
+ /*
+Index: git/bfd/ChangeLog
+===================================================================
+--- git.orig/bfd/ChangeLog     2017-09-04 17:55:10.714664101 +0530
++++ git/bfd/ChangeLog  2017-09-04 17:56:40.991431847 +0530
+@@ -73,6 +73,12 @@
+        (evax_bfd_print_egsd): Check for an overlarge record length.
+        (evax_bfd_print_etir): Likewise.
++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.
++
+ 2017-04-25  Maciej W. Rozycki  <macro@imgtec.com>
+        * readelf.c (process_mips_specific): Remove error reporting from