qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qapi: output visitor crashes qemu if it encounters a NULL value
@ 2014-02-17 11:52 Marcel Apfelbaum
  2014-02-17 17:38 ` Eric Blake
  0 siblings, 1 reply; 6+ messages in thread
From: Marcel Apfelbaum @ 2014-02-17 11:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, mdroth, lcapitulino

A NULL value is not added to visitor's stack, but there
is no check for that when the visitor tries to return
that value, leading to Qemu crash.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
---
 qapi/qmp-output-visitor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
index 74a5684..0562f49 100644
--- a/qapi/qmp-output-visitor.c
+++ b/qapi/qmp-output-visitor.c
@@ -66,6 +66,11 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
 static QObject *qmp_output_first(QmpOutputVisitor *qov)
 {
     QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
+
+    if (!e) {
+        return NULL;
+    }
+
     return e->value;
 }
 
-- 
1.8.3.1

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

end of thread, other threads:[~2014-03-03 16:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-17 11:52 [Qemu-devel] [PATCH] qapi: output visitor crashes qemu if it encounters a NULL value Marcel Apfelbaum
2014-02-17 17:38 ` Eric Blake
2014-02-17 18:01   ` Marcel Apfelbaum
2014-02-28 16:37     ` Luiz Capitulino
2014-03-02 10:15       ` Marcel Apfelbaum
2014-03-03 16:53         ` Luiz Capitulino

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