qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Monitor: Fix command execution regression
@ 2010-01-27 20:01 Luiz Capitulino
  2010-01-28 19:20 ` Blue Swirl
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Capitulino @ 2010-01-27 20:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: agl


Function is_async_return() added by commit 940cc30d0d4 assumes
that 'data', which is returned by handlers, is always a QDict.

This is not true, as QLists can also be returned, in this case
we'll get a segfault.

Fix that by checking if 'data' is a QDict.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/monitor.c b/monitor.c
index fbae5ce..fb7c572 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3700,7 +3700,11 @@ static void monitor_print_error(Monitor *mon)
 
 static int is_async_return(const QObject *data)
 {
-    return data && qdict_haskey(qobject_to_qdict(data), "__mon_async");
+    if (data && qobject_type(data) == QTYPE_QDICT) {
+        return qdict_haskey(qobject_to_qdict(data), "__mon_async");
+    }
+
+    return 0;
 }
 
 static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd,
-- 
1.6.6

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

end of thread, other threads:[~2010-01-28 19:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-27 20:01 [Qemu-devel] [PATCH] Monitor: Fix command execution regression Luiz Capitulino
2010-01-28 19:20 ` Blue Swirl

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