[elfutils] Backport sizeof-pointer-memaccess upstream fixes.

Mark Wielaard mjw at fedoraproject.org
Thu Jan 24 15:15:35 UTC 2013


commit e43443132c9a1efdb4df84d13e57ed82b8230a97
Author: Mark Wielaard <mjw at redhat.com>
Date:   Thu Jan 24 16:12:14 2013 +0100

    Backport sizeof-pointer-memaccess upstream fixes.

 elfutils-0.155-sizeof-pointer-memaccess.patch |   68 +++++++++++++++++++++++++
 elfutils.spec                                 |    7 ++-
 2 files changed, 74 insertions(+), 1 deletions(-)
---
diff --git a/elfutils-0.155-sizeof-pointer-memaccess.patch b/elfutils-0.155-sizeof-pointer-memaccess.patch
new file mode 100644
index 0000000..4e0330c
--- /dev/null
+++ b/elfutils-0.155-sizeof-pointer-memaccess.patch
@@ -0,0 +1,68 @@
+commit 1a4d0668d18bf1090c5c08cdb5cb3ba2b8eb5410
+Author: David Abdurachmanov <David.Abdurachmanov at cern.ch>
+Date:   Sun Jan 13 16:44:21 2013 +0100
+
+    ar.c (do_oper_delete): Fix num passed to memset.
+    
+    Signed-off-by: David Abdurachmanov <David.Abdurachmanov at cern.ch>
+
+diff --git a/src/ar.c b/src/ar.c
+index 03da1b7..2d6ad60 100644
+--- a/src/ar.c
++++ b/src/ar.c
+@@ -919,7 +919,7 @@ do_oper_delete (const char *arfname, char **argv, int argc,
+ 		long int instance)
+ {
+   bool *found = alloca (sizeof (bool) * argc);
+-  memset (found, '\0', sizeof (found));
++  memset (found, '\0', sizeof (bool) * argc);
+ 
+   /* List of the files we keep.  */
+   struct armem *to_copy = NULL;
+
+commit 57bd66cabf6e6b9ecf622cdbf350804897a8df58
+Author: Roland McGrath <roland at hack.frob.com>
+Date:   Tue Dec 11 09:42:07 2012 -0800
+
+    nm: Fix size passed to snprintf for invalid sh_name case.
+    
+    Signed-off-by: Roland McGrath <roland at hack.frob.com>
+
+diff --git a/src/nm.c b/src/nm.c
+index f50da0b..8a1c57a 100644
+--- a/src/nm.c
++++ b/src/nm.c
+@@ -769,8 +769,9 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char *fullname,
+ 			       gelf_getshdr (scn, &shdr_mem)->sh_name);
+       if (unlikely (name == NULL))
+ 	{
+-	  name = alloca (sizeof "[invalid sh_name 0x12345678]");
+-	  snprintf (name, sizeof name, "[invalid sh_name %#" PRIx32 "]",
++          const size_t bufsz = sizeof "[invalid sh_name 0x12345678]"
++	  name = alloca (bufsz);
++	  snprintf (name, bufsz, "[invalid sh_name %#" PRIx32 "]",
+ 		    gelf_getshdr (scn, &shdr_mem)->sh_name);
+ 	}
+       scnnames[elf_ndxscn (scn)] = name;
+
+commit 7df3d2cd70932cd70515dbeb75e4db66fd27f192
+Author: Mark Wielaard <mjw at redhat.com>
+Date:   Tue Dec 11 22:27:05 2012 +0100
+
+    Add missing semicolon in show_symbols_sysv
+    
+    Signed-off-by: Mark Wielaard <mjw at redhat.com>
+
+diff --git a/src/nm.c b/src/nm.c
+index 8a1c57a..7aae84b 100644
+--- a/src/nm.c
++++ b/src/nm.c
+@@ -769,7 +769,7 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char *fullname,
+ 			       gelf_getshdr (scn, &shdr_mem)->sh_name);
+       if (unlikely (name == NULL))
+ 	{
+-          const size_t bufsz = sizeof "[invalid sh_name 0x12345678]"
++	  const size_t bufsz = sizeof "[invalid sh_name 0x12345678]";
+ 	  name = alloca (bufsz);
+ 	  snprintf (name, bufsz, "[invalid sh_name %#" PRIx32 "]",
+ 		    gelf_getshdr (scn, &shdr_mem)->sh_name);
diff --git a/elfutils.spec b/elfutils.spec
index 3b73ec2..6bb65b5 100644
--- a/elfutils.spec
+++ b/elfutils.spec
@@ -1,7 +1,7 @@
 Name: elfutils
 Summary: A collection of utilities and DSOs to handle compiled objects
 Version: 0.155
-%global baserelease 2
+%global baserelease 3
 URL: https://fedorahosted.org/elfutils/
 %global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/
 License: GPLv3+ and (GPLv2+ or LGPLv3+)
@@ -47,6 +47,7 @@ Patch1: %{?source_url}elfutils-robustify.patch
 Patch2: %{?source_url}elfutils-portability.patch
 Patch3: elfutils-0.155-binutils-pr-ld-13621.patch
 Patch4: elfutils-0.155-mem-align.patch
+Patch5: elfutils-0.155-sizeof-pointer-memaccess.patch
 
 %if !%{compat}
 Release: %{baserelease}%{?dist}
@@ -213,6 +214,7 @@ sed -i.scanf-m -e 's/%m/%a/g' src/addr2line.c tests/line2addr.c
 
 %patch3 -p1 -b .binutils-pr-ld-13621
 %patch4 -p1 -b .mem-align
+%patch5 -p1 -b .sizeof-pointer-memaccess
 
 find . -name \*.sh ! -perm -0100 -print | xargs chmod +x
 
@@ -329,6 +331,9 @@ rm -rf ${RPM_BUILD_ROOT}
 %{_libdir}/libelf.a
 
 %changelog
+* Thu Jan 24 2013 Mark Wielaard <mjw at redhat.com> - 0.155-3
+- Backport sizeof-pointer-memaccess upstream fixes.
+
 * Thu Jan 10 2013 Mark Wielaard <mjw at redhat.com> - 0.155-2
 - #891553 - unaligned memory access issues.
 


More information about the scm-commits mailing list