From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbYGT-0003K3-3A for qemu-devel@nongnu.org; Fri, 16 Dec 2011 08:55:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RbYGN-0001v5-B1 for qemu-devel@nongnu.org; Fri, 16 Dec 2011 08:55:57 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:34172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbYGN-0001v1-7K for qemu-devel@nongnu.org; Fri, 16 Dec 2011 08:55:51 -0500 Received: by ghbg19 with SMTP id g19so2762196ghb.4 for ; Fri, 16 Dec 2011 05:55:50 -0800 (PST) Message-ID: <4EEB4DE2.2060805@codemonkey.ws> Date: Fri, 16 Dec 2011 07:55:46 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1324036918-2405-1-git-send-email-pbonzini@redhat.com> <1324036918-2405-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1324036918-2405-2-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org On 12/16/2011 06:01 AM, Paolo Bonzini wrote: > QAPI currently cannot deal with no object pushed to the stack, > and dereferences a NULL pointer. This is visible with > > qom-get path=/i440fx/piix3 property=romfile > > after static non-string properties are introduced. I'm a bit confused about what's happening here. What's the significance of non-string properties? Regards, Anthony Liguori > > Signed-off-by: Paolo Bonzini > --- > qapi/qmp-output-visitor.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c > index f76d015..29575da 100644 > --- a/qapi/qmp-output-visitor.c > +++ b/qapi/qmp-output-visitor.c > @@ -65,13 +65,13 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov) > static QObject *qmp_output_first(QmpOutputVisitor *qov) > { > QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack); > - return e->value; > + return e ? e->value : NULL; > } > > static QObject *qmp_output_last(QmpOutputVisitor *qov) > { > QStackEntry *e = QTAILQ_FIRST(&qov->stack); > - return e->value; > + return e ? e->value : NULL; > } > > static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name,