From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 9A98D3858C2C for ; Sat, 13 Aug 2022 06:49:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9A98D3858C2C Received: by mail-pf1-x431.google.com with SMTP id f30so2704963pfq.4 for ; Fri, 12 Aug 2022 23:49:36 -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; bh=Y73pgwyeAn8sCRmaVM1FwZiTN9khgz3O1V1wpFSEj5E=; b=tgpqqs1Xpyje8S5lbAE0VtzcfcyNFAE4kakcpB09S1UfzNktSVnuP8DvCNB1DJsTBk yPRQQB8LvYGUPvw+bn6oEzHIZj4GostfT60ffnGWPZdvbrUSK2WZdKEbOiGr60lSM6Zp N3u6MmAZ786XR+aKNGdrzCAC/0PYRe47bNqYEPie2nJkjmJP1opRC96lg1ZQ/Fo5DSqi Jn9lGbmidaf0Aq7n1LN3EeGNmu9UUU+X6qe665ZT1JtgfHN2YDcVKeOkvtPc+ScCXyTL a0VpwV86T9FAXatLNDwdnweeORC2DkwO1yUm1obmxNRqqK4OFO0FbAmezUPCW83tnn3A lk+g== X-Gm-Message-State: ACgBeo2N4u2dRez6hqINgqf6rY1qeoRoUfkJ5rgFGjtzn/ZW8ovjmdDB Quyz6pl9lDW5OsOea3P5ZMkotLoLW5k= X-Google-Smtp-Source: AA6agR7ea6vfqGZwWxrz2GL89au2b4p0JK6FbmohelomwLMxW0DYXuFDQkbphb70Ja1DmojpVSZKxg== X-Received: by 2002:a63:5a4d:0:b0:41b:7702:635f with SMTP id k13-20020a635a4d000000b0041b7702635fmr6008391pgm.111.1660373375464; Fri, 12 Aug 2022 23:49:35 -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 d10-20020a170902654a00b0016d338160d6sm2900406pln.155.2022.08.12.23.49.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 23:49:35 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 9814C1142EC1; Sat, 13 Aug 2022 16:19:32 +0930 (ACST) Date: Sat, 13 Aug 2022 16:19:32 +0930 From: Alan Modra To: binutils@sourceware.org Subject: asan: NULL dereference in som_set_reloc_info Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3036.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, T_SCC_BODY_TEXT_LINE 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-List-Received-Date: Sat, 13 Aug 2022 06:49:37 -0000 * som.c (som_set_reloc_info): Ignore non-existent previous fixup references. diff --git a/bfd/som.c b/bfd/som.c index d33ad67561a..c22f13b5a4c 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -4978,6 +4978,11 @@ som_set_reloc_info (unsigned char *fixup, /* Handle a request for a previous fixup. */ if (*fp->format == 'P') { + if (!reloc_queue[fp->D].reloc) + /* The back-reference doesn't exist. This is a broken + object file, likely fuzzed. Just ignore the fixup. */ + continue; + /* Get pointer to the beginning of the prev fixup, move the repeated fixup to the head of the queue. */ fixup = reloc_queue[fp->D].reloc; -- Alan Modra Australia Development Lab, IBM