aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2022-02-02 17:06:22 +0000
committerNick Clifton <nickc@redhat.com>2022-02-02 17:06:22 +0000
commit41ba8b76ccc5bb01507beb3b49df039264bcf34a (patch)
tree76fc11ea2ebdc28c044707e89c67625f66b7f83e
parent2f6b20e2e06eab6c9adbcb678eff1c2114079dde (diff)
downloadgdb-41ba8b76ccc5bb01507beb3b49df039264bcf34a.zip
gdb-41ba8b76ccc5bb01507beb3b49df039264bcf34a.tar.gz
gdb-41ba8b76ccc5bb01507beb3b49df039264bcf34a.tar.bz2
Stop the BFD library complaining about compressed dwarf debug string sections being too big.
PR 28834 * dwarf2.c (read_section): Change the heuristic that checks for overlarge dwarf debug info sections.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/dwarf2.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b213764..607bece 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2022-02-02 Nick Clifton <nickc@redhat.com>
+
+ PR 28834
+ * dwarf2.c (read_section): Change the heuristic that checks for
+ overlarge dwarf debug info sections.
+
2022-02-02 Stafford Horne <shorne@gmail.com>
PR 28735
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index be9983e..fdf071c 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;