[Top][All Lists]

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

Re: [PATCH 2/2] test-keyval: Tighten test of trailing crap after size

From: Eric Blake
Subject: Re: [PATCH 2/2] test-keyval: Tighten test of trailing crap after size
Date: Mon, 25 Nov 2019 10:25:03 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 11/25/19 9:31 AM, Markus Armbruster wrote:
Eric Blake <address@hidden> writes:

On 11/25/19 7:38 AM, Markus Armbruster wrote:
test_keyval_visit_size() should test for trailing crap after size with
and without suffix.  It does test the latter: "sz2=16Gi" has size
"16G" followed by crap "i".  It fails to test the former "sz1=16E" is
a syntactically valid size that overflows uint64_t.  Replace by

         /* Trailing crap */
-    qdict = keyval_parse("sz1=16E,sz2=16Gi", NULL, &error_abort);
+    qdict = keyval_parse("sz1=0Z,sz2=16Gi", NULL, &error_abort);

Does this actually test both failure cases, or does it abort the parse
after the first failure (sz1=0Z) without ever hitting the second half
of the parse (sz2=16Gi)?

Fair question!  Short answer: yes, we check both.

Aha - keyval_parse() just sets up the parser, while the check for double failures is in the test code below.

Clear now?

Reviewed-by: Eric Blake <address@hidden>

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

reply via email to

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