From: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] coverity detected issue in contrib/elf2dmp/main.c
Date: Sat, 16 Feb 2019 10:42:19 +0300 [thread overview]
Message-ID: <20190216104219.46069dd0@phystech.edu> (raw)
In-Reply-To: <CAFEAcA_WNz+=mxvyekHN0u9kSzw6QrmmF9Lz8LzjJaL125zanw@mail.gmail.com>
On Thu, 14 Feb 2019 18:58:46 +0000
Peter Maydell <peter.maydell@linaro.org> wrote:
Hi
> Hi; Coverity detected an issue in contrib/elf2dmp/main.c (CID
> 1398641). In this loop:
>
> for (; KernBase >= 0xfffff78000000000; KernBase -= PAGE_SIZE) {
> nt_start_addr = va_space_resolve(&vs, KernBase);
> if (!nt_start_addr) {
> continue;
> }
>
> if (*(uint16_t *)nt_start_addr == 0x5a4d) { /* MZ */
> break;
> }
> }
>
> we might end exiting with nt_start_addr == NULL, if we go all
> the way through the address range without finding anything
> and the loop terminates via the "KernBase >= 0xfffff78000000000"
> condition.
>
> However, we don't check for this, so we will then segfault
> in pe_get_pdb_symstore_hash(), which assumes it's passed a non-NULL
> address.
>
> I guess we should be checking for nt_start_addr == NULL at the
> end of the loop and treating it as a fatal error?
You're right. I will make a fix.
>
> thanks
> -- PMM
--
Viktor Prutyanov
prev parent reply other threads:[~2019-02-16 7:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 18:58 [Qemu-devel] coverity detected issue in contrib/elf2dmp/main.c Peter Maydell
2019-02-16 7:42 ` Viktor Prutyanov [this message]
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=20190216104219.46069dd0@phystech.edu \
--to=viktor.prutyanov@phystech.edu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).