qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial@nongnu.org, tao3.xu@intel.com, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] test-keyval: Tighten test of trailing crap after size
Date: Mon, 25 Nov 2019 10:25:03 -0600	[thread overview]
Message-ID: <49d5c743-5ff4-2f5a-cb45-a6730d85f5f9@redhat.com> (raw)
In-Reply-To: <87fticdlbx.fsf@dusky.pond.sub.org>

On 11/25/19 9:31 AM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> 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
>>> "sz1=0Z".
>>>

>>>          /* 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?

Yes.
Reviewed-by: Eric Blake <eblake@redhat.com>

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



  reply	other threads:[~2019-11-25 16:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-25 13:38 [PATCH 0/2] Minor integer parsing improvements Markus Armbruster
2019-11-25 13:38 ` [PATCH 1/2] util/cutils: Turn FIXME comment into QEMU_BUILD_BUG_ON() Markus Armbruster
2019-11-25 14:17   ` Philippe Mathieu-Daudé
2019-11-25 13:38 ` [PATCH 2/2] test-keyval: Tighten test of trailing crap after size Markus Armbruster
2019-11-25 14:29   ` Eric Blake
2019-11-25 15:31     ` Markus Armbruster
2019-11-25 16:25       ` Eric Blake [this message]
2019-12-18 11:29   ` Laurent Vivier
2019-11-25 21:33 ` [PATCH 0/2] Minor integer parsing improvements no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49d5c743-5ff4-2f5a-cb45-a6730d85f5f9@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=tao3.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).