[binutils-gdb] Another sanity check for read_section_stabs_debugging_info

Alan Modra amodra@sourceware.org
Sun Mar 19 11:54:07 GMT 2023


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

commit 75831f18a0326573a2116e1f57fa5c8e09bd7738
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Mar 18 12:35:15 2023 +1030

    Another sanity check for read_section_stabs_debugging_info
    
            * rddbg.c (read_section_stabs_debugging_info): Ignore invalid
            stab sections with size less than 12 bytes.

Diff:
---
 binutils/rddbg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/binutils/rddbg.c b/binutils/rddbg.c
index 1a888778312..15081c3f7c7 100644
--- a/binutils/rddbg.c
+++ b/binutils/rddbg.c
@@ -119,6 +119,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
       strsec = bfd_get_section_by_name (abfd, names[i].strsecname);
       if (sec != NULL
 	  && (bfd_section_flags (sec) & SEC_HAS_CONTENTS) != 0
+	  && bfd_section_size (sec) >= 12
 	  && strsec != NULL
 	  && (bfd_section_flags (strsec) & SEC_HAS_CONTENTS) != 0)
 	{


More information about the Binutils-cvs mailing list