aboutsummaryrefslogtreecommitdiff
path: root/qapi
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-03-22 12:51:04 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2012-03-27 09:13:39 -0300
commit2c7ff93359e820f90bfb4ac9efd6ec35949e5630 (patch)
tree18a7673fd1ad94895a6d3e0e1d786c9d18acf098 /qapi
parent3dcf71f632a0a41ff8c9a27f7cf967c647806c07 (diff)
downloadqemu-2c7ff93359e820f90bfb4ac9efd6ec35949e5630.zip
qemu-2c7ff93359e820f90bfb4ac9efd6ec35949e5630.tar.gz
qemu-2c7ff93359e820f90bfb4ac9efd6ec35949e5630.tar.bz2
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>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/qmp-input-visitor.c5
1 files changed, 1 insertions, 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,