aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-03-15 10:26:24 +1030
committerAlan Modra <amodra@gmail.com>2023-03-16 11:11:44 +1030
commitd56e433a7914cdf1ad6db64f7b10506336a8def9 (patch)
treefe61916b6c05a65043433d1da1b14a54e248dbe4 /binutils
parent5a8b54ae6be00f041f2502135285dbb8ba4bea60 (diff)
downloadgdb-d56e433a7914cdf1ad6db64f7b10506336a8def9.zip
gdb-d56e433a7914cdf1ad6db64f7b10506336a8def9.tar.gz
gdb-d56e433a7914cdf1ad6db64f7b10506336a8def9.tar.bz2
Re: Sanity check read_section_stabs_debugging_info
* rddbg.c (read_section_stabs_debugging_info): Don't segfault on zero size string section.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/rddbg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/binutils/rddbg.c b/binutils/rddbg.c
index f2ed6bc..1a88877 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);