From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NaZuq-0006L6-DU for qemu-devel@nongnu.org; Thu, 28 Jan 2010 14:20:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NaZul-0006Bh-M8 for qemu-devel@nongnu.org; Thu, 28 Jan 2010 14:20:31 -0500 Received: from [199.232.76.173] (port=35541 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NaZul-0006BV-HV for qemu-devel@nongnu.org; Thu, 28 Jan 2010 14:20:27 -0500 Received: from mail-pw0-f43.google.com ([209.85.160.43]:60555) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NaZul-0006g9-45 for qemu-devel@nongnu.org; Thu, 28 Jan 2010 14:20:27 -0500 Received: by pwj11 with SMTP id 11so748913pwj.2 for ; Thu, 28 Jan 2010 11:20:26 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20100127180117.5cf438bf@doriath> References: <20100127180117.5cf438bf@doriath> From: Blue Swirl Date: Thu, 28 Jan 2010 19:20:06 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH] Monitor: Fix command execution regression Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel@nongnu.org, agl@us.ibm.com Thanks, applied. On Wed, Jan 27, 2010 at 8:01 PM, Luiz Capitulino w= rote: > > 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 > --- > =C2=A0monitor.c | =C2=A0 =C2=A06 +++++- > =C2=A01 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) > > =C2=A0static int is_async_return(const QObject *data) > =C2=A0{ > - =C2=A0 =C2=A0return data && qdict_haskey(qobject_to_qdict(data), "__mon= _async"); > + =C2=A0 =C2=A0if (data && qobject_type(data) =3D=3D QTYPE_QDICT) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return qdict_haskey(qobject_to_qdict(data), = "__mon_async"); > + =C2=A0 =C2=A0} > + > + =C2=A0 =C2=A0return 0; > =C2=A0} > > =C2=A0static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd= , > -- > 1.6.6 > > > >