qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/4] qobject-input-visitor: Reject non-finite nu


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/4] qobject-input-visitor: Reject non-finite numbers with keyval
Date: Mon, 22 May 2017 12:46:58 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 05/22/2017 11:42 AM, Markus Armbruster wrote:
> The QObject input visitor can produce only finite numbers when its
> input comes out of the JSON parser, because the the JSON parser
> implements RFC 7159, which provides no syntax for infinity and NaN.
> 
> However, it can produce infinity and NaN when its input comes out of
> keyval_parse(), because we parse with strtod() then.
> 
> The keyval variant should not be able to express things the JSON
> variant can't.  Rejecting non-finite numbers there is the conservative
> fix.  It's also minimally invasive.

I also posted patches once (and should revive them) to add more
assertions in our code base that we aren't passing non-finite numbers to
the JSON outputter.

> 
> We could instead extend our JSON dialect to provide for infinity and
> NaN.  Not today.
> 
> Note that the JSON formatter can emit non-finite numbers (marked FIXME
> in commit 6e8e5cb).
> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  qapi/qobject-input-visitor.c       | 3 ++-
>  tests/test-qobject-input-visitor.c | 6 ++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <address@hidden>

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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