From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by sourceware.org (Postfix) with ESMTPS id 8782F3858D39 for ; Tue, 21 Feb 2023 23:01:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8782F3858D39 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-pg1-x532.google.com with SMTP id i31so2597842pgi.10 for ; Tue, 21 Feb 2023 15:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=eBXBRuoHJaHWs77QS6oSci403GP2nfG0LsrsIHxmtEY=; b=N2j4UFWnCW68FbpuXufygYZOpeLoQRDvofYK4Ly4/+gXAlDYNNrU+pSH0i05gJI5sP IjDSRLi02vHWZBK3Bp2QSOf4lWsIBfE+ZhPxrZ8DuHgCxErjyWivDK27EdHIe/0fLzJ0 K3oc6zgReZAHGg+FfY/p9tQYuU7Iuca9PQZbS9nVJVZj5/L2TBlFDxJVxxQMrlVS8jLA a31QKHlFVZbd142U9rdcySX9l+Utnw4R7Axlaha3Pn2DiMEO0JjtjQO2+zjDSt1vF+2e 0vy40oREuFoji0+HMOeEIPvBNXUYvTJxidDuU6httsHRu7Ia5twcM1KN1XjA/NUB9fOE 226g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=eBXBRuoHJaHWs77QS6oSci403GP2nfG0LsrsIHxmtEY=; b=PE23bpbsqKIq91qqOk6lJC6qqbDmWgAHpou/Vo5oFKlCM2k/jzkrcz5HCPgW1gOBj/ Ac1hvYqw4497otzeq4UbKTAYLaNFLKr0Mcyyen+PDybK7wIRi8f27KGqSXUq8Xiza7sk +a9SnV4r16MDJOkJem+b33GB4X/HP3qmwvdJGxETIFCNfN68eMrljp89n9STj4JxrdQK xpS8pGNnv8Uy6kNX124NrnoIfZALMICc6ZKEMuIHypEMrivHpITvakaRSLeLxkbYvxf0 A7sc4/tEURfDdwDqoqheXuT8/kFxmJC0lLFvCGNw1HAF6X0JPkZox+oB1PWziB91nIM4 3GFA== X-Gm-Message-State: AO0yUKVcnNhm7HTkjDcAPOrOcT3pY0HBMFuklaXylyr/lvYWnytuaubg pAcyXKZ2+Xq5bkCygCo1Auk+2CoR9rc= X-Google-Smtp-Source: AK7set85AWcWSTLlB6qeLkHz6WDcZH1FksghU8N6sT1uGRgXemEl3pfLBHQgRZVrfZeR/1Mr7PX9jw== X-Received: by 2002:a62:1aca:0:b0:5a8:d407:60f9 with SMTP id a193-20020a621aca000000b005a8d40760f9mr4872741pfa.29.1677020503358; Tue, 21 Feb 2023 15:01:43 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:815a:53dc:52ea:9cb]) by smtp.gmail.com with ESMTPSA id 17-20020aa79211000000b005abc0d426c4sm6917005pfo.54.2023.02.21.15.01.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 15:01:42 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id D40821142769; Wed, 22 Feb 2023 09:31:39 +1030 (ACDT) Date: Wed, 22 Feb 2023 09:31:39 +1030 From: Alan Modra To: binutils@sourceware.org Subject: Re: objdump read_section_stabs Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3034.9 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: Commit f9c36cc99518 changed (and renamed) read_section_stabs with one difference in overall behaviour. Previously read_section_stabs would return a NULL for an empty section, which was then treated the same as a missing section. Now an empty section is recognized and dumped. This leads to NULL stabp and stabs_end in print_section_stabs. Since stabs_end - STABSIZE is then a pointer to a very large address, the test "stabp < stabs_end - STABSIZE" succeeds. * objdump.c (print_section_stabs): Correct STABSIZE comparison. diff --git a/binutils/objdump.c b/binutils/objdump.c index 984c7219a0c..40ed6882b45 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -4508,7 +4508,7 @@ print_section_stabs (bfd *abfd, We start the index at -1 because there is a dummy symbol on the front of stabs-in-{coff,elf} sections that supplies sizes. */ - for (i = -1; stabp <= stabs_end - STABSIZE; stabp += STABSIZE, i++) + for (i = -1; (size_t) (stabs_end - stabp) >= STABSIZE; stabp += STABSIZE, i++) { const char *name; unsigned long strx; -- Alan Modra Australia Development Lab, IBM