[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V2 1/4] qapi: output visitor crashes qemu if it enco
From: |
Marcel Apfelbaum |
Subject: |
[Qemu-devel] [PATCH V2 1/4] qapi: output visitor crashes qemu if it encounters a NULL value |
Date: |
Mon, 26 May 2014 15:40:55 +0300 |
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.
Reviewed-by: Eric Blake <address@hidden>
Acked-by: Luiz Capitulino <address@hidden>
Signed-off-by: Marcel Apfelbaum <address@hidden>
---
qapi/qmp-output-visitor.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
index 74a5684..96b3384 100644
--- a/qapi/qmp-output-visitor.c
+++ b/qapi/qmp-output-visitor.c
@@ -66,6 +66,12 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
static QObject *qmp_output_first(QmpOutputVisitor *qov)
{
QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
+
+ /* FIXME - find a better way to deal with NULL values */
+ if (!e) {
+ return NULL;
+ }
+
return e->value;
}
--
1.8.3.1