source: scripts/patch/binutils/2.19.1/25-build_id.patch@ c58eb217

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since c58eb217 was bb6d7f8, checked in by Jim Gifford <clfs@…>, 15 years ago

Added new binutils patch

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[bb6d7f8]1Fix build-id patch to avoid memory corruption. (BZ 501582)
2
3diff -rup ../binutils-2.19.51.0.11.orig/bfd/elfcode.h bfd/elfcode.h
4--- ../binutils-2.19.51.0.11.orig/bfd/elfcode.h 2009-07-14 11:23:27.000000000 +0100
5+++ bfd/elfcode.h 2009-07-14 11:33:56.000000000 +0100
6@@ -1170,6 +1170,24 @@ elf_checksum_contents (bfd *abfd,
7
8 if (i_shdr.contents)
9 (*process) (i_shdr.contents, i_shdr.sh_size, arg);
10+ else
11+ {
12+ asection *sec;
13+
14+ sec = bfd_section_from_elf_index (abfd, count);
15+ if (sec != NULL)
16+ {
17+ if (sec->contents == NULL)
18+ {
19+ /* Force rereading from file. */
20+ sec->flags &= ~SEC_IN_MEMORY;
21+ if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
22+ continue;
23+ }
24+ if (sec->contents != NULL)
25+ (*process) (sec->contents, i_shdr.sh_size, arg);
26+ }
27+ }
28 }
29
30 return TRUE;
31diff -rup ../binutils-2.19.51.0.11.orig/bfd/section.c bfd/section.c
32--- ../binutils-2.19.51.0.11.orig/bfd/section.c 2009-07-14 11:23:27.000000000 +0100
33+++ bfd/section.c 2009-07-14 11:33:26.000000000 +0100
34@@ -1477,7 +1477,7 @@ bfd_malloc_and_get_section (bfd *abfd, s
35 if (sz == 0)
36 return TRUE;
37
38- p = bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
39+ p = bfd_zmalloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
40 if (p == NULL)
41 return FALSE;
42 *buf = p;
43
Note: See TracBrowser for help on using the repository browser.