From: Paolo Bonzini <pbonz...@redhat.com> QmpOutputVisitor will segfault if an imbalanced end function is called. So we can abort in QmpInputVisitor too.
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> Reviewed-by: Anthony Liguori <aligu...@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com> --- qapi/qmp-input-visitor.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c index e6b6152..b4013cc 100644 --- a/qapi/qmp-input-visitor.c +++ b/qapi/qmp-input-visitor.c @@ -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, -- 1.7.9.2.384.g4a92a