aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-01-04 21:39:54 +1030
committerAlan Modra <amodra@gmail.com>2023-01-04 23:52:26 +1030
commitefff45b40a10ab0b3bdc16c3f20cf4af3f6dea88 (patch)
tree3861e6700970db7d9e2971f235af6018efaab7d8 /bfd
parentb77a357567b8640003a7301b1bd50bd81fd7a26a (diff)
downloadbinutils-efff45b40a10ab0b3bdc16c3f20cf4af3f6dea88.zip
binutils-efff45b40a10ab0b3bdc16c3f20cf4af3f6dea88.tar.gz
binutils-efff45b40a10ab0b3bdc16c3f20cf4af3f6dea88.tar.bz2
addr2line out of memory on fuzzed file
Another case of fuzzers finding the section size sanity checks are avoided with SHT_NOBITS sections. * dwarf2.c (read_section): Check that the DWARF section being read has contents.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/dwarf2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 6eb6e04..f689eeb 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -705,6 +705,14 @@ read_section (bfd *abfd,
return false;
}
+ if ((msec->flags & SEC_HAS_CONTENTS) == 0)
+ {
+ _bfd_error_handler (_("DWARF error: section %s has no contents"),
+ section_name);
+ bfd_set_error (bfd_error_no_contents);
+ return false;
+ }
+
if (_bfd_section_size_insane (abfd, msec))
{
/* PR 26946 */