public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* addr2line out of memory on fuzzed file
@ 2023-01-04 13:25 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-01-04 13:25 UTC (permalink / raw)
  To: binutils

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.

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 6eb6e04e6e5..f689eebbd88 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 */

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-04 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04 13:25 addr2line out of memory on fuzzed file Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).