Skip to content
Snippets Groups Projects
Commit 1d10b445 authored by Marcel Apfelbaum's avatar Marcel Apfelbaum Committed by Andreas Färber
Browse files

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: default avatarEric Blake <eblake@redhat.com>
Acked-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: default avatarMarcel Apfelbaum <marcel.a@redhat.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
parent 13d7adf9
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment