From nobody Thu Nov 6 19:29:25 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 1542819293644641.745413613721; Wed, 21 Nov 2018 08:54:53 -0800 (PST) Received: from localhost ([::1]:40207 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPVm3-0008Ap-4W for importer@patchew.org; Wed, 21 Nov 2018 11:54:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPVcI-0007Ya-Ln for qemu-devel@nongnu.org; Wed, 21 Nov 2018 11:44:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPVcH-0006of-VB for qemu-devel@nongnu.org; Wed, 21 Nov 2018 11:44:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39256) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPVcH-0006na-Q4 for qemu-devel@nongnu.org; Wed, 21 Nov 2018 11:44:41 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DBE4307DAA2; Wed, 21 Nov 2018 16:44:41 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-177.ams2.redhat.com [10.36.116.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC00E5C21E; Wed, 21 Nov 2018 16:44:39 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 21 Nov 2018 17:44:21 +0100 Message-Id: <20181121164421.20780-10-david@redhat.com> In-Reply-To: <20181121164421.20780-1-david@redhat.com> References: <20181121164421.20780-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 21 Nov 2018 16:44:41 +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 v3 for-4.0 9/9] test-string-input-visitor: Add range overflow tests 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 make sure that the range handling code can properly deal with ranges that end at the biggest possible number. Reviewed-by: Markus Armbruster Signed-off-by: David Hildenbrand --- tests/test-string-input-visitor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-vi= sitor.c index 9b1dd44b2d..34b54dfc89 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -112,6 +112,7 @@ static void test_visitor_in_intList(TestInputVisitorDat= a *data, int64_t expect2[] =3D { 32767, -32768, -32767 }; int64_t expect3[] =3D { INT64_MIN, INT64_MAX }; int64_t expect4[] =3D { 1 }; + int64_t expect5[] =3D { INT64_MAX - 2, INT64_MAX - 1, INT64_MAX }; Error *err =3D NULL; int64List *res =3D NULL; Visitor *v; @@ -132,6 +133,10 @@ static void test_visitor_in_intList(TestInputVisitorDa= ta *data, v =3D visitor_input_test_init(data, "1-1"); check_ilist(v, expect4, ARRAY_SIZE(expect4)); =20 + v =3D visitor_input_test_init(data, + "9223372036854775805-9223372036854775807"); + check_ilist(v, expect5, ARRAY_SIZE(expect5)); + /* Value too large */ =20 v =3D visitor_input_test_init(data, "9223372036854775808"); @@ -216,6 +221,7 @@ static void test_visitor_in_uintList(TestInputVisitorDa= ta *data, uint64_t expect3[] =3D { INT64_MIN, INT64_MAX }; uint64_t expect4[] =3D { 1 }; uint64_t expect5[] =3D { UINT64_MAX }; + uint64_t expect6[] =3D { UINT64_MAX - 2, UINT64_MAX - 1, UINT64_MAX }; Error *err =3D NULL; uint64List *res =3D NULL; Visitor *v; @@ -239,6 +245,10 @@ static void test_visitor_in_uintList(TestInputVisitorD= ata *data, v =3D visitor_input_test_init(data, "18446744073709551615"); check_ulist(v, expect5, ARRAY_SIZE(expect5)); =20 + v =3D visitor_input_test_init(data, + "18446744073709551613-18446744073709551615= "); + check_ulist(v, expect6, ARRAY_SIZE(expect6)); + /* Value too large */ =20 v =3D visitor_input_test_init(data, "18446744073709551616"); --=20 2.17.2