summary refs log tree commit diff stats
path: root/include/qapi/visitor.h
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-04-28 15:45:26 -0600
committerMarkus Armbruster <armbru@redhat.com>2016-05-12 09:47:55 +0200
commit56a6f02b8ce1fe41a2a9077593e46eca7d98267d (patch)
tree8071e53eba8577e41476d4f2f4b7e082862ab51c /include/qapi/visitor.h
parentf2ff429bfa713da1366333417fecfa939a709cf1 (diff)
downloadfocaccia-qemu-56a6f02b8ce1fe41a2a9077593e46eca7d98267d.tar.gz
focaccia-qemu-56a6f02b8ce1fe41a2a9077593e46eca7d98267d.zip
qmp: Tighten output visitor rules
Tighten assertions in the QMP output visitor, so that:

- qmp_output_get_qobject() can only be called after pairing a
visit_end_* for every visit_start_* (rather than allowing it on
a partially built object)

- qmp_output_get_qobject() cannot be called unless at least one
visit_type_* or visit_start/visit_end pair has occurred since
creation/reset (the accidental return of NULL fixed by commit
ab8bf1d7 would have been much easier to diagnose)

- ensure that we are encountering the expected object or list
type, to provide protection against mismatched push(struct)/
pop(list) or push(list)/pop(struct), similar to the qmp-input
protection added in commit bdd8e6b5.

- ensure that except for the root, 'name' is non-null inside a
dict, and NULL inside a list (this may need changing later if
we add "name.0" support for better error messages for a list,
but for now it makes sure all users are at least consistent)

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1461879932-9020-19-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'include/qapi/visitor.h')
0 files changed, 0 insertions, 0 deletions