--- binutils.orig/bfd/elf-attrs.c 2018-07-05 11:14:28.914603764 +0100 +++ binutils-2.29.1/bfd/elf-attrs.c 2018-07-05 11:14:58.249275811 +0100 @@ -438,6 +438,15 @@ _bfd_elf_parse_attributes (bfd *abfd, El /* PR 17512: file: 2844a11d. */ if (hdr->sh_size == 0) return; + if (hdr->sh_size > bfd_get_file_size (abfd)) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: error: attribute section '%pA' too big: %#llx"), + abfd, hdr->bfd_section, (long long) hdr->sh_size); + bfd_set_error (bfd_error_invalid_operation); + return; + } + contents = (bfd_byte *) bfd_malloc (hdr->sh_size + 1); if (!contents) return;