[binutils/f18] Prevent a seg-fault in readelf when examining a corrupt archive. Resolves: #908567

Nicholas Clifton nickc at fedoraproject.org
Thu Feb 7 15:03:42 UTC 2013


commit d5dcee51cfd244b8ce00a5416dbacf2213858df7
Author: Nick Clifton <nickc at redhat.com>
Date:   Thu Feb 7 14:59:03 2013 +0000

    Prevent a seg-fault in readelf when examining a corrupt archive.
    Resolves: #908567

 binutils-2.23.51.0.1-readelf-corrupt-ar.patch |   17 +++++++++++++++++
 binutils.spec                                 |    8 +++++++-
 2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/binutils-2.23.51.0.1-readelf-corrupt-ar.patch b/binutils-2.23.51.0.1-readelf-corrupt-ar.patch
new file mode 100644
index 0000000..124f238
--- /dev/null
+++ b/binutils-2.23.51.0.1-readelf-corrupt-ar.patch
@@ -0,0 +1,17 @@
+*** ../binutils-2.23.51.0.1.orig/binutils/elfcomm.c	2013-02-07 14:41:00.436014549 +0000
+--- binutils/elfcomm.c	2013-02-07 14:42:09.749012357 +0000
+*************** get_archive_member_name (struct archive_
+*** 586,591 ****
+--- 586,597 ----
+        char *member_file_name;
+        char *member_name;
+  
++       if (arch->longnames == NULL || arch->longnames_size == 0)
++ 	{
++ 	  error (_("Archive member uses long names, but no longname table found\n"));
++ 	  return NULL;
++ 	}
++       
+        arch->nested_member_origin = 0;
+        k = j = strtoul (arch->arhdr.ar_name + 1, &endp, 10);
+        if (arch->is_thin_archive && endp != NULL && * endp == ':')
diff --git a/binutils.spec b/binutils.spec
index b70e430..4f2bf87 100644
--- a/binutils.spec
+++ b/binutils.spec
@@ -17,7 +17,7 @@
 Summary: A GNU collection of binary utilities
 Name: %{?cross}binutils%{?_with_debug:-debug}
 Version: 2.23.51.0.1
-Release: 7%{?dist}
+Release: 8%{?dist}
 License: GPLv3+
 Group: Development/Tools
 URL: http://sources.redhat.com/binutils
@@ -47,6 +47,8 @@ Patch12: binutils-rh805974.patch
 Patch13: binutils-rh805107.patch
 Patch14: binutils-2.23.51.0.1-arm-whitespace.patch
 Patch15: binutils-2.23.51.0.1-ppc64-dyn-rel-count.patch
+# Prevent seg-fault in readelf when reading a corrupt archive file.
+Patch16: binutils-2.23.51.0.1-readelf-corrupt-ar.patch
 
 %define gold_arches %ix86 x86_64
 
@@ -155,6 +157,7 @@ using libelf instead of BFD.
 %patch13 -p1 
 %patch14 -p0 -b .arm-whitespace~ 
 %patch15 -p0 -b .dyn-rel-count~ 
+%patch16 -p0 -b .corrupt-ar~ 
 
 # We cannot run autotools as there is an exact requirement of autoconf-2.59.
 
@@ -453,6 +456,9 @@ exit 0
 %endif # %{isnative}
 
 %changelog
+* Thu Feb  7 2013 Nick Clifton<nickc at redhat.com> 2.23.51.0.1-8
+- Prevent a seg-fault in readelf when examining a corrupt archive.  (#908567)
+
 * Mon Feb  4 2013 Nick Clifton<nickc at redhat.com> 2.23.51.0.1-7
 - Don't error when elf_gc_sweep_symbol clears def_regular.  (#906273)
 


More information about the scm-commits mailing list