diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-03-22 12:51:04 +0100 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-03-27 09:13:39 -0300 |
commit | 2c7ff93359e820f90bfb4ac9efd6ec35949e5630 (patch) | |
tree | 18a7673fd1ad94895a6d3e0e1d786c9d18acf098 /qapi | |
parent | 3dcf71f632a0a41ff8c9a27f7cf967c647806c07 (diff) |
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.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c index e6b6152e08..b4013ccfc5 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, |