提交 1d10b445 编写于 作者: M Marcel Apfelbaum 提交者: Andreas Färber

qapi: Avoid output visitor crashing if it encounters a NULL value

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: NEric Blake <eblake@redhat.com>
Acked-by: NLuiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: NMarcel Apfelbaum <marcel.a@redhat.com>
Acked-by: NMichael S. Tsirkin <mst@redhat.com>
Acked-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 13d7adf9
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册