qapi: fail hard on stack imbalance
QmpOutputVisitor will segfault if an imbalanced end function is called. So we can abort in QmpInputVisitor too. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
3dcf71f632
commit
2c7ff93359
@ -77,11 +77,8 @@ static void qmp_input_push(QmpInputVisitor *qiv, const QObject *obj, Error **err
|
||||
|
||||
static void qmp_input_pop(QmpInputVisitor *qiv, Error **errp)
|
||||
{
|
||||
assert(qiv->nb_stack > 0);
|
||||
qiv->nb_stack--;
|
||||
if (qiv->nb_stack < 0) {
|
||||
error_set(errp, QERR_BUFFER_OVERRUN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void qmp_input_start_struct(Visitor *v, void **obj, const char *kind,
|
||||
|
Loading…
Reference in New Issue
Block a user