[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC V2 5/9] qapi: output visitor crashes qemu if it
From: |
Marcel Apfelbaum |
Subject: |
[Qemu-devel] [PATCH RFC V2 5/9] qapi: output visitor crashes qemu if it encounters a NULL value |
Date: |
Sun, 2 Mar 2014 15:07:08 +0200 |
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>
Signed-off-by: Marcel Apfelbaum <address@hidden>
---
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
- Re: [Qemu-devel] [PATCH RFC V2 3/9] hw/boards: converted current_machine to be an instance of QemuMachineCLass, (continued)
Re: [Qemu-devel] [PATCH RFC V2 2/9] vl: use qemu machine QOM class instead of global machines list, Andreas Färber, 2014/03/03
[Qemu-devel] [PATCH RFC V2 5/9] qapi: output visitor crashes qemu if it encounters a NULL value,
Marcel Apfelbaum <=
Re: [Qemu-devel] [PATCH RFC V2 0/9] qemu-machine as a QOM object, Paolo Bonzini, 2014/03/03