From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.121]) by mx.groups.io with SMTP id smtpd.web10.2751.1582234754864730306 for ; Thu, 20 Feb 2020 13:39:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=jzCkhhVK; spf=pass (domain: microsoft.com, ip: 40.107.223.121, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QU0C3hgDGXbluEXyQWpEjYgfYC8v2PYLKr1wi+2sakEdrCjUgynpfQ8wQgoi+Z0UpiscPjFX5BBb6nyB/rZXPESHVULUKPZVb47oH4tjuD7hTBWFW/9JMPBh5VP8cVxpjxERXHfClx5WMgpr5F+flOYp2qMr3IReqYtTFVxwJgdND2DVn0LGmqO1I3Nhwxj2Xn9zVE2MZYfrlYlES3xQCljkJBlT6sU7iAYk0A6wL/N9r0VoMFMX48pqFnw0TaY3GIXBVbOFIxBp6UmCHyK1akaanWv9iOGjRzGS9rcFE10b03rRXKjcHzK3v1OlO7w/4ENE2foE+fNzcQZ/fx4Xvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=geK/ImEDgMF+skB8tk7BTxw+6zzUm0b/+cmv3pXvPQQ=; b=XG+Rm1NDJUi0FE8UDr2o6rfmfd44gIl5iZoQqgIZIRa6UZxXdbzhbf66k4+efAK/l5dY16wNfcRwiMEmrKcV2FREqu3mFq+I5hZSqIMb8hYwQRtHHHWUCyTbuGPq03RLPbJXHoOexO/jItt4y0ztNKnADAlu0sOsn/lwnfKDQPoR5goJdhHw2WHALDcWx9YVEk2MB1RN9MzFMPurs/i3RA8rd1RIuvNLkbIdOQSgXa4cNmxWyQE/nzbzqsHLXbzOAon8OCDMLcsXPGsMbAYd7pYMSAhqBoX/fmjsjeHAu1iSgwO7FjD2cilCLY2r448Q/edFNEFP+86j5CSz6n0VMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=geK/ImEDgMF+skB8tk7BTxw+6zzUm0b/+cmv3pXvPQQ=; b=jzCkhhVKz1LPoq5OG5pgoo3I1/fc2XNx60z/RznbwnoP3xsR3UXw7LAuQcDWFmFpul3tTJNJoPK1eudd1Av4+E17nEKhS4/8oD3cCHpdkRPMdbefRT0DQQ9bURLpf5GfHL8/YBdCzIq9Po4RGydv3JaM4jRUJcMR3W/3K3ePwS8= Received: from CY4PR21MB0743.namprd21.prod.outlook.com (2603:10b6:903:b2::9) by CY4PR21MB0773.namprd21.prod.outlook.com (2603:10b6:903:b8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.4; Thu, 20 Feb 2020 21:39:13 +0000 Received: from CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::9118:22ef:23c:d0ab]) by CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::9118:22ef:23c:d0ab%9]) with mapi id 15.20.2772.006; Thu, 20 Feb 2020 21:39:13 +0000 From: "Bret Barkelew" To: "devel@edk2.groups.io" , "newexplorerj@gmail.com" CC: GuoMinJ Subject: Re: [EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used. Thread-Topic: [EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used. Thread-Index: AQHV549OsekW/ZrICU+sBX1VTmKwXqgknTLx Date: Thu, 20 Feb 2020 21:39:13 +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: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2020-02-20T21:38:58.4449896Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Privileged authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bret.Barkelew@microsoft.com; x-originating-ip: [2001:4898:80e8:9:9d08:96d2:3991:c152] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 03e87cf2-5bf7-4e4f-a245-08d7b64d5408 x-ms-traffictypediagnostic: CY4PR21MB0773: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 031996B7EF x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(4636009)(346002)(376002)(136003)(366004)(396003)(39860400002)(189003)(199004)(5660300002)(55016002)(8936002)(2906002)(478600001)(966005)(10290500003)(8676002)(81166006)(9686003)(33656002)(52536014)(316002)(110136005)(71200400001)(86362001)(81156014)(8990500004)(66556008)(53546011)(7696005)(66946007)(64756008)(6506007)(91956017)(186003)(66446008)(76116006)(4326008)(66476007);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR21MB0773;H:CY4PR21MB0743.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MFmbLekyDG4gbQVkcBlJgvzQ4SkQWMmErp/dezRceqzizvJdcGSUKG8H+nHfwUn4yagCdsWKkItqwTgZBsEqANlpjlHMUbR14ZBUAGPKDtIXbvjsmfimG3pP5F2lve01V92LLEdHkezbU+1vUJFpDOuzRxCauHlcqOBwBCygfAd0+okELQJnTk9OmOu8PcBtMGr17BtoQTKJ5spvXw0rl53e4TKa8vQSvUixzsRd9d4VR590SN1Ruz5sNqfwGIHZdt8u/Hw04VAoz29c4SLxhHWrT2o9UwxSbWuHat2N/2FpuYDNVVagOQpb9N6En2ka5cr4HcPNpAGoJNbK1GgUH5GxPzCCqZqwclErKYiq36VmYNDA8Bj2Yb54NijrW3VRfLl8YDNrKYTAswNSYuiPOmYwZbZYbjvFyAxVhJGPXa5ePNk5uSjD4Y3CGxzLiAjDvLD6EFIGOe4slDzBtYDGmMbkxHLL4kL1C2muMYpv/e2ZqE8o3U1v8optUaVWr+WJSvB8AnB+pOvS5Xas2u69Jg== x-ms-exchange-antispam-messagedata: GHF+HAUFh3WodP6mpekY8JY2nZnj45kncHmkMigGMR+RaGNusDpiM4F/faydz6wGpSvDYVvaSbb3ePETSjbRWyPdzP4O4oSBDcKFYNH7jrz89sLi/wBxcWixOzT1hLCDdoMqv6ln8roVf9m3OBMw+xEOznfJm7NgaVboQxZVPlexGO6cMvFYejJKs5CbAjLApcakbHCdmmcGeK01t0T8EA== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03e87cf2-5bf7-4e4f-a245-08d7b64d5408 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Feb 2020 21:39:13.2874 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 94iqAprtTQ+Cxcg+8EQnpIrNILb7EyDH2noUdW3vlEW+AYiDDghkOQqnubITQO+Pg/cyivzz838TrRj3ApjcMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0773 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CY4PR21MB07436C88C773EF7346232E86EF130CY4PR21MB0743namp_" --_000_CY4PR21MB07436C88C773EF7346232E86EF130CY4PR21MB0743namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bret Barkelew - Bret ________________________________ From: devel@edk2.groups.io on behalf of GuoMinJ via= Groups.Io Sent: Wednesday, February 19, 2020 5:41:56 PM To: devel@edk2.groups.io Cc: GuoMinJ Subject: [EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid ind= ex may be used. REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2535&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7C49deda8899264bfbb32108d7b5a66f87%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637177598752484898&sdata=3DWySGg%2BbeLnDD= t98xRUOhjGd1DkNyU5m8HiRInsVKm4Q%3D&reserved=3D0 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. Signed-off-by: GuoMinJ --- .../Library/UnitTestResultReportLib/UnitTestResultReportLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTest= ResultReportLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/Un= itTestResultReportLib.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; - 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; - 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 --_000_CY4PR21MB07436C88C773EF7346232E86EF130CY4PR21MB0743namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Reviewed-by: Bret Barkelew <bret.barkelew@micros= oft.com>

 

- Bret

 


From: devel@edk2.groups.io= <devel@edk2.groups.io> on behalf of GuoMinJ via Groups.Io <newexp= lorerj=3Dgmail.com@groups.io>
Sent: Wednesday, February 19, 2020 5:41:56 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: GuoMinJ <newexplorerj@gmail.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Inva= lid index may be used.
 
REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2535&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7C49deda8899264bfbb32108d7b5a66f87%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637177598752484898&amp;sdata=3DWySGg%2BbeL= nDDt98xRUOhjGd1DkNyU5m8HiRInsVKm4Q%3D&amp;reserved=3D0

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.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
---
 .../Library/UnitTestResultReportLib/UnitTestResultReportLib.c | 4 &#= 43;+--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTest= ResultReportLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/Un= itTestResultReportLib.c
index 687a04f55d..eba68e330c 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR= eportLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/Uni= tTestResultReportLib.c
@@ -65,7 +65,7 @@ GetStringForUnitTestStatus (
 {
   UINTN  Index;
 
-  for (Index =3D 0; Index < ARRAY_SIZE (mStatusStrings); Index= 3;+) {
+  for (Index =3D 0; Index < ARRAY_SIZE (mStatusStrings) - 1; = Index++) {
     if (mStatusStrings[Index].Status =3D=3D Status) {=
       //
       // Return string from matching entry<= br> @@ -87,7 +87,7 @@ GetStringForFailureType (
 {
   UINTN  Index;
 
-  for (Index =3D 0; Index < ARRAY_SIZE (mFailureTypeStrings); Ind= ex++) {
+  for (Index =3D 0; Index < ARRAY_SIZE (mFailureTypeStrings) = - 1; Index++) {
     if (mFailureTypeStrings[Index].Type =3D=3D Failur= e) {
       //
       // Return string from matching entry<= br> --
2.17.1




--_000_CY4PR21MB07436C88C773EF7346232E86EF130CY4PR21MB0743namp_--