From nobody Thu Nov 6 18:04:31 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542290834776497.8161928755658; Thu, 15 Nov 2018 06:07:14 -0800 (PST) Received: from localhost ([::1]:38993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIIW-0006MN-Cb for importer@patchew.org; Thu, 15 Nov 2018 09:07:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIGo-0005bk-AX for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:05:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIGj-0004Le-Ow for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:05:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18925) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNIGj-0004L5-K2 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:05:17 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 26A259981B; Thu, 15 Nov 2018 14:05:16 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-224.ams2.redhat.com [10.36.117.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ED36600CD; Thu, 15 Nov 2018 14:05:12 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:04:55 +0100 Message-Id: <20181115140501.7872-4-david@redhat.com> In-Reply-To: <20181115140501.7872-1-david@redhat.com> References: <20181115140501.7872-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 15 Nov 2018 14:05:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 3/9] qapi: use qemu_strtod_finite() in string-input-visitor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , David Hildenbrand , Markus Armbruster , Michael Roth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Let's use the new function. "NaN" and "inf" are now properly rejected. Signed-off-by: David Hildenbrand Reviewed-by: Eric Blake --- qapi/string-input-visitor.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index b3fdd0827d..b89c6c4e06 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -20,6 +20,7 @@ #include "qemu/option.h" #include "qemu/queue.h" #include "qemu/range.h" +#include "qemu/cutils.h" =20 =20 struct StringInputVisitor @@ -313,12 +314,9 @@ static void parse_type_number(Visitor *v, const char *= name, double *obj, Error **errp) { StringInputVisitor *siv =3D to_siv(v); - char *endp =3D (char *) siv->string; double val; =20 - errno =3D 0; - val =3D strtod(siv->string, &endp); - if (errno || endp =3D=3D siv->string || *endp) { + if (qemu_strtod_finite(siv->string, NULL, &val)) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "number"); return; --=20 2.17.2