From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 790793858D38 for ; Thu, 16 Mar 2023 00:55:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 790793858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x629.google.com with SMTP id a2so93942plm.4 for ; Wed, 15 Mar 2023 17:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678928156; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=pPN8dX2/PJJnRBMRF8la/oDtnRO+JSi68SazZTbJtEk=; b=iVSgRcJkkPCydPNm55a4Yd0Ht1Xqd93prkduJqorBHbUIj0CCwXjd/jnu1TRaQitW2 +W5p4NGPyyiOTnnv8vQ10EugkVDFcvsGY67hySuUbq4MggMYrv1TzZxN2iBUJI9No6eG Ud+Ze4cnRM22ui0L+6XGE0CKn9KXFbtVgcqJplvbm5LsBM11o25XK5YsnLx7983OK0+f 73IW5tIidUw1kEDa7OnpH/W7JE4YLW2epUgbwV2QVapCUJ+llLEQNcijMZ4izXK1K4o+ LX7/NOMqtJkPMKBWl8f44XjJ/33yGxjDLeDRL7+geQUyW9gkbUakL+8lDERENMFBjWv2 0wqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678928156; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pPN8dX2/PJJnRBMRF8la/oDtnRO+JSi68SazZTbJtEk=; b=bY1x9ba9gPS4sF+WcDY1P7zil27V4GuFqRgZHd1/bEN3sGVbejC72f8n4cIIcn4BtS /C1/ZlQBzkHuzhCcd/ze/XXcTBblAZP6w77P/9EEHx3/ClkGiHjcvPqhj7v53FWFY0gn JVZJHWmvSj6L3C1TUnMjMSRqS1F8tdACsl4+2guqk767SnhAuiFAQmu5F27mfnDkP45o ig/zDw22wFd9Q9xeFfPveTgmSiHxqSLfMiVbOX+8El6YM8/ny5UB35OHItOmUJcoVA5k 5ioSgSGPH/4oors7vy4YKwPiQfUwtYKHmRN5VUq7Y2DCdUH0j3Ao10n4dBSY4xQO5rT4 nDgw== X-Gm-Message-State: AO0yUKVJOmjEIoTNjgO1ULRYlYJ+BjW6oCyVSV1k3aLrjYsb4nHcImda lbYvdwHt9WSeCZYjTDVF23/kfQihWDA= X-Google-Smtp-Source: AK7set89q14SDsnQGjOR7hfsNIQ0styNDNex/Lbe3TobCyx9XgLHDsGi8UTMISLUtJD2I3saQQxSEg== X-Received: by 2002:a17:903:64e:b0:19c:be03:d18b with SMTP id kh14-20020a170903064e00b0019cbe03d18bmr1321431plb.22.1678928156361; Wed, 15 Mar 2023 17:55:56 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:a4a8:b43e:46ff:b99b]) by smtp.gmail.com with ESMTPSA id lk15-20020a17090308cf00b0019ab151eb90sm4215765plb.139.2023.03.15.17.55.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 17:55:55 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 9C7551142D19; Thu, 16 Mar 2023 11:25:53 +1030 (ACDT) Date: Thu, 16 Mar 2023 11:25:53 +1030 From: Alan Modra To: binutils@sourceware.org Subject: Re: Sanity check read_section_stabs_debugging_info Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3034.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * 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); -- Alan Modra Australia Development Lab, IBM