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

clfs-3.0.0-sysvinit sysvinit
Last change on this file since c318be6 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
  • bfd/elfcode.h

    Fix build-id patch to avoid memory corruption.  (BZ 501582)
    
    diff -rup ../binutils-2.19.51.0.11.orig/bfd/elfcode.h bfd/elfcode.h
    old new elf_checksum_contents (bfd *abfd,  
    11701170
    11711171      if (i_shdr.contents)
    11721172        (*process) (i_shdr.contents, i_shdr.sh_size, arg);
     1173      else
     1174        {
     1175          asection *sec;
     1176
     1177          sec = bfd_section_from_elf_index (abfd, count);
     1178          if (sec != NULL)
     1179            {
     1180              if (sec->contents == NULL)
     1181                {
     1182                  /* Force rereading from file.  */
     1183                  sec->flags &= ~SEC_IN_MEMORY;
     1184                  if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
     1185                    continue;
     1186                }
     1187              if (sec->contents != NULL)
     1188                (*process) (sec->contents, i_shdr.sh_size, arg);
     1189            }
     1190        }
    11731191    }
    11741192
    11751193  return TRUE;
  • bfd/section.c

    diff -rup ../binutils-2.19.51.0.11.orig/bfd/section.c bfd/section.c
    old new bfd_malloc_and_get_section (bfd *abfd, s  
    14771477  if (sz == 0)
    14781478    return TRUE;
    14791479
    1480   p = bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
     1480  p = bfd_zmalloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
    14811481  if (p == NULL)
    14821482    return FALSE;
    14831483  *buf = p;
Note: See TracBrowser for help on using the repository browser.