From: Nick Clifton Date: Wed, 2 Feb 2022 17:07:31 +0000 (+0000) Subject: Stop the BFD library from complaining that dwarf debug string sections are too big. X-Git-Tag: binutils-2_38~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=203c99c9b9a9c58cce472a1bd4315e3f79b440b7;p=thirdparty%2Fbinutils-gdb.git Stop the BFD library from complaining that dwarf debug string sections are too big. PR 28834 * dwarf2.c (read_section): Change the heuristic that checks for overlarge dwarf debug info sections. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index aec055dba81..6c876968278 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2022-02-02 Nick Clifton + + PR 28834 + * dwarf2.c (read_section): Change the heuristic that checks for + overlarge dwarf debug info sections. + 2022-01-24 Nick Clifton * po/fr.po: Updated French translation. diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index be9983edbf0..fdf071c36e9 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -557,10 +557,14 @@ read_section (bfd * abfd, amt = bfd_get_section_limit_octets (abfd, msec); filesize = bfd_get_file_size (abfd); - if (amt >= filesize) + /* PR 28834: A compressed debug section could well decompress to a size + larger than the file, so we choose an arbitrary modifier of 10x in + the test below. If this ever turns out to be insufficient, it can + be changed by a future update. */ + if (amt >= filesize * 10) { /* PR 26946 */ - _bfd_error_handler (_("DWARF error: section %s is larger than its filesize! (0x%lx vs 0x%lx)"), + _bfd_error_handler (_("DWARF error: section %s is larger than 10x its filesize! (0x%lx vs 0x%lx)"), section_name, (long) amt, (long) filesize); bfd_set_error (bfd_error_bad_value); return false;