qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel]  [PATCH] qemu-img: Fix segmentation fault
@ 2012-05-11 16:57 Charles Arnold
  2012-05-14 12:24 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Arnold @ 2012-05-11 16:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf

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>
---

diff --git a/qemu-img.c b/qemu-img.c
index 0ae543c..113de93 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 *));

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-img: Fix segmentation fault
  2012-05-11 16:57 [Qemu-devel] [PATCH] qemu-img: Fix segmentation fault Charles Arnold
@ 2012-05-14 12:24 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2012-05-14 12:24 UTC (permalink / raw)
  To: Charles Arnold; +Cc: qemu-devel

Am 11.05.2012 18:57, schrieb Charles Arnold:
> 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>

Thanks, applied to the block branch for 1.1.

Kevin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-14 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-11 16:57 [Qemu-devel] [PATCH] qemu-img: Fix segmentation fault Charles Arnold
2012-05-14 12:24 ` Kevin Wolf

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).