From: Alan Modra Date: Tue, 14 Mar 2023 23:56:24 +0000 (+1030) Subject: Re: Sanity check read_section_stabs_debugging_info X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d56e433a7914cdf1ad6db64f7b10506336a8def9;p=binutils-gdb.git Re: Sanity check read_section_stabs_debugging_info * rddbg.c (read_section_stabs_debugging_info): Don't segfault on zero size string section. --- diff --git a/binutils/rddbg.c b/binutils/rddbg.c index f2ed6bcb3dd..1a888778312 100644 --- a/binutils/rddbg.c +++ b/binutils/rddbg.c @@ -147,7 +147,8 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount, } /* Zero terminate the strings table, just in case. */ strsize = bfd_section_size (strsec); - strings [strsize - 1] = 0; + if (strsize != 0) + strings [strsize - 1] = 0; if (shandle == NULL) { shandle = start_stab (dhandle, abfd, true, syms, symcount);