public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: cgen@sourceware.org, binutils@sourceware.org
Subject: Re: Uninitialized variable read in cgen disassembler
Date: Tue, 11 Feb 2020 01:43:00 -0000	[thread overview]
Message-ID: <20200211014321.GS5669@bubble.grove.modra.org> (raw)
In-Reply-To: <20200207140121.GJ5669@bubble.grove.modra.org>

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

  reply	other threads:[~2020-02-11  1:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 14:01 Alan Modra
2020-02-11  1:43 ` Alan Modra [this message]
     [not found]   ` <20200211032214.GG29244@redhat.com>
     [not found]     ` <20200211101607.GV5669@bubble.grove.modra.org>
2020-02-11 11:18       ` Frank Ch. Eigler
2021-09-27 14:13 cgen&sourceware org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200211014321.GS5669@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=cgen@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).