X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf-attrs.c;h=070104c27344322d286c9b8cf2bd8ab17e4693d9;hb=31af1e68af26f5cae209de3530d0455b8a944b2d;hp=b3533095fff2ea4d53d7380c95663515435fde74;hpb=95a6d23566165208853a68d9cd3c6eedca840ec6;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c index b3533095ff..070104c273 100644 --- a/bfd/elf-attrs.c +++ b/bfd/elf-attrs.c @@ -1,5 +1,5 @@ /* ELF attributes support (based on ARM EABI attributes). - Copyright (C) 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2020 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -42,6 +42,8 @@ uleb128_size (unsigned int i) static bfd_boolean is_default_attr (obj_attribute *attr) { + if (ATTR_TYPE_HAS_ERROR (attr->type)) + return TRUE; if (ATTR_TYPE_HAS_INT_VAL (attr->type) && attr->i != 0) return FALSE; if (ATTR_TYPE_HAS_STR_VAL (attr->type) && attr->s && *attr->s) @@ -104,7 +106,7 @@ vendor_obj_attr_size (bfd *abfd, int vendor) size += obj_attr_size (list->tag, &list->attr); /* NUL 0x1 */ - return ((size || vendor == OBJ_ATTR_PROC) + return (size ? size + 10 + strlen (vendor_name) : 0); } @@ -434,11 +436,14 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) bfd_byte *p_end; bfd_vma len; const char *std_sec; + ufile_ptr filesize; /* PR 17512: file: 2844a11d. */ if (hdr->sh_size == 0) return; - if (hdr->sh_size > bfd_get_file_size (abfd)) + + filesize = bfd_get_file_size (abfd); + if (filesize != 0 && hdr->sh_size > filesize) { /* xgettext:c-format */ _bfd_error_handler (_("%pB: error: attribute section '%pA' too big: %#llx"),