On 02/26/2017 03:43 PM, Markus Armbruster wrote: > When you try to visit beyond the end of a list, the qobject input > visitor crashes, and the string visitor screws returns garbage. The > generated list visits never go beyond the list end, but manual visits > could. > > Signed-off-by: Markus Armbruster <[email protected]> > --- > tests/test-opts-visitor.c | 39 > ++++++++++++++++++++++++++++++++++++++ > tests/test-qobject-input-visitor.c | 10 ++++++++++ > tests/test-string-input-visitor.c | 16 ++++++++++++++++ > 3 files changed, 65 insertions(+) >
>
> +static void
> +test_opts_range_beyond(void)
> +{
> +
> + /* Would be simpler if the visitor genuinely supported virtual walks */
> + visit_start_list(v, "ilist", (GenericList **)&list, sizeof(*list),
> + &error_abort);
> + tail = list;
> + visit_type_int(v, NULL, &tail->value, &error_abort);
> + g_assert_cmpint(tail->value, ==, 0);
> + tail = (intList *)visit_next_list(v, (GenericList *)tail, sizeof(*tail));
> + g_assert(!tail);
> + visit_type_int(v, NULL, &val, &err);
> + error_free_or_abort(&err);
> + visit_end_list(v, (void **)&list);
> +
Wow - something the opts visitor does better than the qobject visitor! Gasp!
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
