From: Alan Modra <amodra@gmail.com>
To: cgen@sourceware.org
Subject: Uninitialized variable read in cgen disassembler
Date: Fri, 07 Feb 2020 14:01:00 -0000 [thread overview]
Message-ID: <20200207140121.GJ5669@bubble.grove.modra.org> (raw)
I noticed this today in opcodes/m32c-ibld.c line 2498
case M32C_OPERAND_IMM_40_SI :
{
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 24, 32, total_length, pc, & value);
value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680))));
fields->f_dsp_40_u24 = value;
}
if (length <= 0) break;
length = extract_normal (cd, ex_info, insn_value, 0, 64, 0, 8, 32, total_length, pc, & fields->f_dsp_64_u8);
if (length <= 0) break;
{
FLD (f_dsp_40_s32) = ((((FLD (f_dsp_40_u24)) & (16777215))) | (((((FLD (f_dsp_64_u8)) << (24))) & (0xff000000))));
}
}
break;
Oops, the first "length <= 0" check on the return value of
extract_normal is *after* we've already used "value".
There's a return path in extract_normal that doesn't set *valuep,
when fill_cache fails.
--
Alan Modra
Australia Development Lab, IBM
next reply other threads:[~2020-02-07 14:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-07 14:01 Alan Modra [this message]
2020-02-11 1:43 ` Alan Modra
[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=20200207140121.GJ5669@bubble.grove.modra.org \
--to=amodra@gmail.com \
--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).