提交 1f41a645 编写于 作者: M Markus Armbruster

qapi: Fix object input visit beyond end of list

Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Message-Id: <1488544368-30622-28-git-send-email-armbru@redhat.com>
上级 a9416dc6
......@@ -122,10 +122,15 @@ static QObject *qobject_input_try_get_object(QObjectInputVisitor *qiv,
} else {
assert(qobject_type(qobj) == QTYPE_QLIST);
assert(!name);
ret = qlist_entry_obj(tos->entry);
assert(ret);
if (tos->entry) {
ret = qlist_entry_obj(tos->entry);
if (consume) {
tos->entry = qlist_next(tos->entry);
}
} else {
ret = NULL;
}
if (consume) {
tos->entry = qlist_next(tos->entry);
tos->index++;
}
}
......
......@@ -953,10 +953,8 @@ static void test_visitor_in_fail_list(TestInputVisitorData *data,
v = visitor_input_test_init(data, "[]");
visit_start_list(v, NULL, NULL, 0, &error_abort);
#if 0 /* FIXME crash */
visit_type_int(v, NULL, &i64, &err);
error_free_or_abort(&err);
#endif
visit_end_list(v, NULL);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册