From patchwork Wed Oct 26 06:51:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 11080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp94160wru; Tue, 25 Oct 2022 23:51:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Xg+xrt84wY0uMf6HAyrwb6IDT9rRO8CZfs/8KaahXAvn+yU4vx8Gt2N1r+yp5ySUuw+lr X-Received: by 2002:a17:907:9603:b0:742:9ed3:3af2 with SMTP id gb3-20020a170907960300b007429ed33af2mr35962878ejc.510.1666767100540; Tue, 25 Oct 2022 23:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666767100; cv=none; d=google.com; s=arc-20160816; b=Y8AozugDyd1buWQdjTnrUGPV+8cAcavA7cun/IQAwo6ubaAUBvElTixbgDsz+RQ9Sy PRwDTelavrmRV3cWRfxBX6KBntgJAwWULrsAFo+ysg7tBFyK5kRMajnQjM30ytlEgdtY moB40Hts9i4q2RfL9lS4VFNSNdA5vP/F5q4PWRDnPdQz28CqpqRj/nhP2k3Z+r80OhUM hb7ELgxDMfFc+x25KuhA3xToopo3BeetxhJQ9B3iGBhSnNgTsacVqaBF8hr6Y/cdGe4d GSOD8kW0rHr0dgeQdUJfOYxwcTo8ddmxs6RTX7rZLpzwOe6t30L/BuU21GXEqOoXrt7L pJcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=5426nMHCi/LbOoUIWXYWYwsOkj6YECLayQycf5p/Mx4=; b=Za4p7kYu+j4jw5l8f92cfMS3A6CuGNuVw1SykpsP/f2vMWOIKnLtFA5VJ2RvMhjXc5 WWUOXkboOfL1/9Ia5IgrS5fl5bU6fHD7BjYbhT7xrv6sesNaWMtv13H4spA0dIsELzCF guir5J6+B9MnZVXoHgD5obY8fVJcVWY9tbqmkwP6fUIZlY2VGyr4/DpOyzPeTH37whgT U8yB0jC4ldbDuppiCYT1JdkviHTcmkAKSPOji2lbyvXxTKYbV/DKKXWJV5u1dMrjyQAc kD+f+V2ESF0csLLb8wK0b3r61G+i7WBMMs12TjiBviRHIlb7MV+Qj7V+sbLHOStn4dNp hxaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=jUECyaN4; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id jg22-20020a170907971600b00797a5ba1347si4703556ejc.594.2022.10.25.23.51.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 23:51:40 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=jUECyaN4; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 576A23851C12 for ; Wed, 26 Oct 2022 06:51:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 576A23851C12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666767099; bh=5426nMHCi/LbOoUIWXYWYwsOkj6YECLayQycf5p/Mx4=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jUECyaN425t4MF+ZgDQtCicGQ5WSOmBIquCDKZj5n/mCqEzdgBVReXhHBeKu0KkQ4 6Gk7Ohlh8/YFGK3NffOPDYJN6WE6820jUnayxmNEVZTT4j9zL90qB4UlsV4aqNDTpW qUX0Rgv/fbINQgSP+Lqpx23nx0sLbv7vBirHGT1o= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org 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 5BDB2385735F for ; Wed, 26 Oct 2022 06:51:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5BDB2385735F Received: by mail-pg1-x532.google.com with SMTP id q1so13907568pgl.11 for ; Tue, 25 Oct 2022 23:51:31 -0700 (PDT) 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=5426nMHCi/LbOoUIWXYWYwsOkj6YECLayQycf5p/Mx4=; b=MBK6NpHBB9n3FmXRBaMUvQ+gV+4icYCpG9gIXrKu2eIvJPu3WmsVn/s0lmuQHN1vXR rKDqvmEqnBsrP/Yd0BKrKrdsoKijFdhrlD4yJ5qc8NhhfQedLvycUGgDE0L31GFzPJ0f vR/VURyy5A5Xyh8qENrcvmwCowycbKsZcFV94eWUcWVZN1Q8RAWEAZqP0dYRZtG+TtUQ OniUTuXxe+7weoIM/+8IbdbQtUGMYmN0UKuWWtQSUxnVGNu98yB8I25T1YuebmXzd57O LzDPnEingymnJov1c2vy/QwibVkD0Gg3CKvEMDidUxbETxYzG2hJh6sZBj7oP765eKRL Px1Q== X-Gm-Message-State: ACrzQf0IdaDgDuabB5QinooiCdgJWme186m/K4ZPQMJPU+SLOXjbUgxM PxJnHRJfa6kNa8FnAQtUjRFUBoF9zJ0= X-Received: by 2002:a63:cf48:0:b0:439:7d1c:fedc with SMTP id b8-20020a63cf48000000b004397d1cfedcmr36663027pgj.281.1666767089985; Tue, 25 Oct 2022 23:51:29 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id h14-20020a170902f54e00b00186e2123506sm121361plf.300.2022.10.25.23.51.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 23:51:28 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 3A5801142D9C; Wed, 26 Oct 2022 17:21:26 +1030 (ACDT) Date: Wed, 26 Oct 2022 17:21:26 +1030 To: binutils@sourceware.org Subject: segfault in objdump.c reloc_at Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3036.3 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747731979463690040?= X-GMAIL-MSGID: =?utf-8?q?1747731979463690040?= bfd_canonicalize_reloc returns -1L on errors. * objdump.c (load_specific_debug_section): Properly handle error return from bfd_canonicalize_reloc. diff --git a/binutils/objdump.c b/binutils/objdump.c index a4ab0dbd66c..0825e051ef6 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -4212,13 +4212,13 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, if (reloc_size > 0) { - unsigned long reloc_count; + long reloc_count; arelent **relocs; relocs = (arelent **) xmalloc (reloc_size); reloc_count = bfd_canonicalize_reloc (abfd, sec, relocs, NULL); - if (reloc_count == 0) + if (reloc_count <= 0) free (relocs); else {