From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41088 invoked by alias); 11 Feb 2020 01:43:30 -0000 Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org Received: (qmail 41063 invoked by uid 89); 11 Feb 2020 01:43:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HTo:U*cgen X-HELO: mail-pl1-f179.google.com Received: from mail-pl1-f179.google.com (HELO mail-pl1-f179.google.com) (209.85.214.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Feb 2020 01:43:28 +0000 Received: by mail-pl1-f179.google.com with SMTP id y8so3550595pll.13; Mon, 10 Feb 2020 17:43:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=T9BD1KnQ1O9NIG23cDNFGtejkeyLa8izyrQZ2R96FHs=; b=eMluipe8bXM8hp9G04KBR6cBUzb4IPYZe2/YdoWb9d607JW/mG+u0fX5RHknZONUTi qw/yeoKweih+HBvm4jzPCCSjlfRUrybUq90oEJmHv7LmZQkBhZ8QZOFQF8QGbwBCKeUF wLv2R1YHdsPATtGovyqlanxC4Wc08fVEvKDEb/Q0Ns0uoYmNIL+juV8EFFtqX0Q7Uhis ITyUTzch6gJwl3l2vYrEXvK9IXNIsGHZQnYVzU3yUW9ISnfLbxg0m/QSBECE7qPrKBPr 5WAa0FYqVVGZkvJ95Wqr+CpBHz6NTqyQ6yy7199neDorWhxzeBvHRxP6uxl5uB3BA+2E Awsw== Return-Path: Received: from bubble.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id e1sm1709097pfl.98.2020.02.10.17.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 17:43:25 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id C0B7E807F6; Tue, 11 Feb 2020 12:13:21 +1030 (ACDT) Date: Tue, 11 Feb 2020 01:43:00 -0000 From: Alan Modra To: cgen@sourceware.org, binutils@sourceware.org Subject: Re: Uninitialized variable read in cgen disassembler Message-ID: <20200211014321.GS5669@bubble.grove.modra.org> References: <20200207140121.GJ5669@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200207140121.GJ5669@bubble.grove.modra.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-SW-Source: 2020-q1/txt/msg00006.txt On Sat, Feb 08, 2020 at 12:31:21AM +1030, Alan Modra wrote: > There's a return path in extract_normal that doesn't set *valuep, > when fill_cache fails. Let's fix that then. * cgen-ibld.in (extract_normal): Set *valuep on all return paths. * bpf-ibld.c, * epiphany-ibld.c, * fr30-ibld.c, * frv-ibld.c, * ip2k-ibld.c, * iq2000-ibld.c, * lm32-ibld.c, * m32c-ibld.c, * m32r-ibld.c, * mep-ibld.c, * mt-ibld.c, * or1k-ibld.c, * xc16x-ibld.c, * xstormy16-ibld.c: Regenerate. diff --git a/opcodes/cgen-ibld.in b/opcodes/cgen-ibld.in index 9d856cda83..6a9b97fcb5 100644 --- a/opcodes/cgen-ibld.in +++ b/opcodes/cgen-ibld.in @@ -479,7 +479,10 @@ extract_normal (CGEN_CPU_DESC cd, abort (); if (fill_cache (cd, ex_info, word_offset / 8, word_length / 8, pc) == 0) - return 0; + { + *valuep = 0; + return 0; + } value = extract_1 (cd, ex_info, start, length, word_length, bufp, pc); } -- Alan Modra Australia Development Lab, IBM