[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
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 0/4] qapi: Handle some keyval fallout, Markus Armbruster, 2017/05/22
- [Qemu-devel] [PATCH 2/4] qapi: Document visit_type_any() issues with keyval input, Markus Armbruster, 2017/05/22
- [Qemu-devel] [PATCH 1/4] qobject-input-visitor: Reject non-finite numbers with keyval, Markus Armbruster, 2017/05/22
- Re: [Qemu-devel] [PATCH 1/4] qobject-input-visitor: Reject non-finite numbers with keyval,
Eric Blake <=
- [Qemu-devel] [PATCH 3/4] tests/qapi-schema: Avoid 'str' in alternate test cases, Markus Armbruster, 2017/05/22
- [Qemu-devel] [PATCH 4/4] qapi: Reject alternates that can't work with keyval_parse(), Markus Armbruster, 2017/05/22
- Re: [Qemu-devel] [PATCH 0/4] qapi: Handle some keyval fallout, Marc-André Lureau, 2017/05/26