qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: anthony@codemonkey.ws
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] qemu-img: Fix segmentation fault
Date: Mon, 14 May 2012 17:44:17 +0200	[thread overview]
Message-ID: <1337010257-9324-4-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1337010257-9324-1-git-send-email-kwolf@redhat.com>

From: Charles Arnold <carnold@suse.com>

The following command generates a segmentation fault.
qemu-img convert -O vpc -o ? test test2
This is because the 'goto out;' statement calls qemu_progress_end
before qemu_progress_init is called resulting in a NULL pointer
invocation.

Signed-off-by: Charles Arnold <carnold@suse.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-img.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index 5434ddc..c8a70ff 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -712,6 +712,9 @@ static int img_convert(int argc, char **argv)
 
     out_filename = argv[argc - 1];
 
+    /* Initialize before goto out */
+    qemu_progress_init(progress, 2.0);
+
     if (options && !strcmp(options, "?")) {
         ret = print_block_option_help(out_filename, out_fmt);
         goto out;
@@ -724,7 +727,6 @@ static int img_convert(int argc, char **argv)
         goto out;
     }
 
-    qemu_progress_init(progress, 2.0);
     qemu_progress_print(0, 100);
 
     bs = g_malloc0(bs_n * sizeof(BlockDriverState *));
-- 
1.7.6.5

  parent reply	other threads:[~2012-05-14 15:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14 15:44 [Qemu-devel] [PULL 0/3] Block patches for 1.1 Kevin Wolf
2012-05-14 15:44 ` [Qemu-devel] [PATCH 1/3] coroutine: Fix setup of sigaltstack coroutines Kevin Wolf
2012-05-14 15:44 ` [Qemu-devel] [PATCH 2/3] qcow2: Don't ignore failure to clear autoclear flags Kevin Wolf
2012-05-14 15:44 ` Kevin Wolf [this message]
2012-05-14 20:09 ` [Qemu-devel] [PULL 0/3] Block patches for 1.1 Anthony Liguori

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=1337010257-9324-4-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=anthony@codemonkey.ws \
    --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).