mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
qapi: Assert non-input visitors see only valid alternate tags
An alternate type's visit_type_FOO() fails when it runs into an invalid ->type. This is appropriate with an input visitor: visit_start_alternate() sets ->type according to the input, and bad input can lead to bad ->type. It should never happen with an output, clone or dealloc visitor: if it did, the alternate being output, cloned or deallocated would be messed up beyond repair. Assert that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200424084338.26803-12-armbru@redhat.com>
This commit is contained in:
parent
c978bd5226
commit
7111a86e1b
1 changed files with 1 additions and 0 deletions
|
@ -232,6 +232,7 @@ def gen_visit_alternate(name, variants):
|
|||
case QTYPE_NONE:
|
||||
abort();
|
||||
default:
|
||||
assert(visit_is_input(v));
|
||||
error_setg(&err, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"%(name)s");
|
||||
/* Avoid passing invalid *obj to qapi_free_%(c_name)s() */
|
||||
|
|
Loading…
Reference in a new issue