mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
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: Eric Blake <[email protected]> Acked-by: Luiz Capitulino <[email protected]> Signed-off-by: Marcel Apfelbaum <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Acked-by: Michael Roth <[email protected]> Signed-off-by: Andreas Färber <[email protected]>
This commit is contained in:
1 parent
13d7adf92a
commit
1d10b44546
1 file changed
+6
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user