public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Re: stab nearest_line bfd_malloc_and_get_section
@ 2022-10-05  4:25 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-10-05  4:25 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=011a13613403c42717c623b0c5fc1e69de9f65b5

commit 011a13613403c42717c623b0c5fc1e69de9f65b5
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Oct 5 10:27:46 2022 +1030

    Re: stab nearest_line bfd_malloc_and_get_section
    
    It didn't take long for the fuzzers to avoid size checks in
    bfd_malloc_and_get_section.  Plug this hole.
    
            * syms.c (_bfd_stab_section_find_nearest_line): Ignore fuzzed
            sections with no contents.

Diff:
---
 bfd/syms.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bfd/syms.c b/bfd/syms.c
index e8077f59bf0..c9d27ebe5d4 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -1019,6 +1019,10 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
 	    return true;
 	}
 
+      if ((info->stabsec->flags & SEC_HAS_CONTENTS) == 0
+	  || (info->strsec->flags & SEC_HAS_CONTENTS) == 0)
+	goto out;
+
       stabsize = (info->stabsec->rawsize
 		  ? info->stabsec->rawsize
 		  : info->stabsec->size);

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

only message in thread, other threads:[~2022-10-05  4:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-05  4:25 [binutils-gdb] Re: stab nearest_line bfd_malloc_and_get_section 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).