qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 24/26] tests: Cover input visit beyond end of


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 24/26] tests: Cover input visit beyond end of list
Date: Tue, 28 Feb 2017 10:19:10 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

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 <address@hidden>
> ---
>  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 <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]