From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web09.8276.1583308763543249992 for ; Tue, 03 Mar 2020 23:59:23 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: shenglei.zhang@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2020 23:59:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,513,1574150400"; d="scan'208";a="440918677" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 03 Mar 2020 23:59:23 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 3 Mar 2020 23:59:22 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.206]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.201]) with mapi id 14.03.0439.000; Wed, 4 Mar 2020 15:59:20 +0800 From: "Zhang, Shenglei" To: "devel@edk2.groups.io" , "newexplorerj@gmail.com" Subject: Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used. Thread-Topic: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used. Thread-Index: AQHV549QR3bmRjtKJE2D0XEx/xKdUqg4Jm8A Date: Wed, 4 Mar 2020 07:59:19 +0000 Message-ID: References: <02ae08887ff10e981ee247a74ce2e89eb1a4d747.1582162590.git.newexplorerj@gmail.com> In-Reply-To: <02ae08887ff10e981ee247a74ce2e89eb1a4d747.1582162590.git.newexplorerj@gmail.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: shenglei.zhang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Shenglei Zhang > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > GuoMinJ > Sent: Thursday, February 20, 2020 9:42 AM > To: devel@edk2.groups.io > Cc: GuoMinJ > Subject: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be > used. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2535 >=20 > The UINT_TEST_STATUS and FAILURE_TYPE have used 0 as status, so use 0 as > unknown is confused, remove it from array enumeration but keep it > location in the array. >=20 > Signed-off-by: GuoMinJ > --- > .../Library/UnitTestResultReportLib/UnitTestResultReportLib.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR > eportLib.c > b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR > eportLib.c > index 687a04f55d..eba68e330c 100644 > --- > a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR > eportLib.c > +++ > b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR > eportLib.c > @@ -65,7 +65,7 @@ GetStringForUnitTestStatus ( > { > UINTN Index; >=20 > - for (Index =3D 0; Index < ARRAY_SIZE (mStatusStrings); Index++) { > + for (Index =3D 0; Index < ARRAY_SIZE (mStatusStrings) - 1; Index++) { > if (mStatusStrings[Index].Status =3D=3D Status) { > // > // Return string from matching entry > @@ -87,7 +87,7 @@ GetStringForFailureType ( > { > UINTN Index; >=20 > - for (Index =3D 0; Index < ARRAY_SIZE (mFailureTypeStrings); Index++) = { > + for (Index =3D 0; Index < ARRAY_SIZE (mFailureTypeStrings) - 1; Index= ++) { > if (mFailureTypeStrings[Index].Type =3D=3D Failure) { > // > // Return string from matching entry > -- > 2.17.1 >=20 >=20 >=20