Fix build-id patch to avoid memory corruption. (BZ 501582)

This commit is contained in:
Nicholas Clifton 2009-07-14 09:48:32 +00:00
parent ca76cc18dc
commit fdf1169030
2 changed files with 18 additions and 11 deletions

View File

@ -1,7 +1,7 @@
diff -rup ../binutils-2.19.51.0.10.orig/bfd/elfcode.h ./bfd/elfcode.h
--- ../binutils-2.19.51.0.10.orig/bfd/elfcode.h 2009-06-22 16:16:08.000000000 +0100
+++ ./bfd/elfcode.h 2009-06-22 16:20:00.000000000 +0100
@@ -1170,6 +1170,20 @@ elf_checksum_contents (bfd *abfd,
diff -rup ../binutils-2.19.51.0.11.orig/bfd/elfcode.h bfd/elfcode.h
--- ../binutils-2.19.51.0.11.orig/bfd/elfcode.h 2009-07-14 11:23:27.000000000 +0100
+++ bfd/elfcode.h 2009-07-14 11:33:56.000000000 +0100
@@ -1170,6 +1170,24 @@ elf_checksum_contents (bfd *abfd,
if (i_shdr.contents)
(*process) (i_shdr.contents, i_shdr.sh_size, arg);
@ -12,9 +12,13 @@ diff -rup ../binutils-2.19.51.0.10.orig/bfd/elfcode.h ./bfd/elfcode.h
+ sec = bfd_section_from_elf_index (abfd, count);
+ if (sec != NULL)
+ {
+ if (sec->contents == NULL
+ && ! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
+ continue;
+ if (sec->contents == NULL)
+ {
+ /* Force rereading from file. */
+ sec->flags &= ~SEC_IN_MEMORY;
+ if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
+ continue;
+ }
+ if (sec->contents != NULL)
+ (*process) (sec->contents, i_shdr.sh_size, arg);
+ }
@ -22,9 +26,9 @@ diff -rup ../binutils-2.19.51.0.10.orig/bfd/elfcode.h ./bfd/elfcode.h
}
return TRUE;
diff -rup ../binutils-2.19.51.0.10.orig/bfd/section.c ./bfd/section.c
--- ../binutils-2.19.51.0.10.orig/bfd/section.c 2009-06-22 16:16:08.000000000 +0100
+++ ./bfd/section.c 2009-06-22 16:20:42.000000000 +0100
diff -rup ../binutils-2.19.51.0.11.orig/bfd/section.c bfd/section.c
--- ../binutils-2.19.51.0.11.orig/bfd/section.c 2009-07-14 11:23:27.000000000 +0100
+++ bfd/section.c 2009-07-14 11:33:26.000000000 +0100
@@ -1477,7 +1477,7 @@ bfd_malloc_and_get_section (bfd *abfd, s
if (sz == 0)
return TRUE;

View File

@ -17,7 +17,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.19.51.0.11
Release: 24%{?dist}
Release: 25%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@ -351,6 +351,9 @@ fi
%endif # %{isnative}
%changelog
* Tue Jul 14 2009 Nick Clifton <nickc@redhat.com> 2.19.51.0.11-25
- Fix build-id patch to avoid memory corruption. (BZ 501582)
* Sat Jul 11 2009 Jan Kratochvil <jan.kratochvil@redhat.com> 2.19.51.0.11-24
- Provide uuencode output of the testsuite results.