qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com
Subject: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference
Date: Fri, 16 Dec 2011 13:01:51 +0100	[thread overview]
Message-ID: <1324036918-2405-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1324036918-2405-1-git-send-email-pbonzini@redhat.com>

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.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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,
-- 
1.7.7.1

  reply	other threads:[~2011-12-16 12:02 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16 12:01 [Qemu-devel] [PATCH 0/8] qom: introduce non-legacy static properties Paolo Bonzini
2011-12-16 12:01 ` Paolo Bonzini [this message]
2011-12-16 13:55   ` [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference Anthony Liguori
2011-12-16 14:00     ` Paolo Bonzini
2011-12-16 14:10       ` Anthony Liguori
2011-12-16 14:22         ` Paolo Bonzini
2011-12-16 14:46           ` Anthony Liguori
2011-12-16 14:49             ` Paolo Bonzini
2011-12-16 14:56               ` Anthony Liguori
2011-12-16 15:03                 ` Paolo Bonzini
2011-12-16 15:05                   ` Anthony Liguori
2011-12-16 15:13                     ` Paolo Bonzini
2011-12-16 15:23                       ` Anthony Liguori
2011-12-16 15:42                         ` Paolo Bonzini
2011-12-16 15:54                           ` Anthony Liguori
2011-12-16 16:17                             ` Paolo Bonzini
2011-12-16 16:24                   ` Gerd Hoffmann
2011-12-16 12:01 ` [Qemu-devel] [PATCH 2/8] qapi: protect against NULL QObject in qmp_input_get_object Paolo Bonzini
2011-12-16 13:56   ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 3/8] qom: fix swapped parameters Paolo Bonzini
2011-12-16 13:57   ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 4/8] qom: push permission checks up into qdev_property_add_legacy Paolo Bonzini
2011-12-16 13:58   ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 5/8] qom: introduce QERR_PROPERTY_VALUE_OUT_OF_RANGE Paolo Bonzini
2011-12-16 14:00   ` Anthony Liguori
2011-12-16 14:01     ` Paolo Bonzini
2011-12-16 17:00       ` Paolo Bonzini
2011-12-16 17:01         ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 6/8] qom: introduce get/set methods for Property Paolo Bonzini
2011-12-16 13:11   ` Gerd Hoffmann
2011-12-16 13:51     ` Paolo Bonzini
2011-12-16 14:05       ` Anthony Liguori
2011-12-16 14:18         ` Paolo Bonzini
2011-12-16 14:44           ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 7/8] qom: distinguish "legacy" property type name from QOM type name Paolo Bonzini
2011-12-16 14:06   ` Anthony Liguori
2011-12-16 14:18     ` Paolo Bonzini
2011-12-16 14:43       ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 8/8] qom: register qdev properties also as non-legacy properties Paolo Bonzini
2011-12-16 13:54 ` [Qemu-devel] [PATCH 0/8] qom: introduce non-legacy static properties 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=1324036918-2405-2-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kwolf@redhat.com \
    --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).