public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bret Barkelew" <bret.barkelew@microsoft.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"newexplorerj@gmail.com" <newexplorerj@gmail.com>
Cc: GuoMinJ <newexplorerj@gmail.com>
Subject: Re: [EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.
Date: Thu, 20 Feb 2020 21:39:13 +0000	[thread overview]
Message-ID: <CY4PR21MB07436C88C773EF7346232E86EF130@CY4PR21MB0743.namprd21.prod.outlook.com> (raw)
In-Reply-To: <02ae08887ff10e981ee247a74ce2e89eb1a4d747.1582162590.git.newexplorerj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2198 bytes --]

Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>

- Bret

________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of GuoMinJ via Groups.Io <newexplorerj=gmail.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: Invalid index may be used.

REF: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2535&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7C49deda8899264bfbb32108d7b5a66f87%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637177598752484898&amp;sdata=WySGg%2BbeLnDDt98xRUOhjGd1DkNyU5m8HiRInsVKm4Q%3D&amp;reserved=0

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 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
index 687a04f55d..eba68e330c 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
@@ -65,7 +65,7 @@ GetStringForUnitTestStatus (
 {
   UINTN  Index;

-  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings) - 1; Index++) {
     if (mStatusStrings[Index].Status == Status) {
       //
       // Return string from matching entry
@@ -87,7 +87,7 @@ GetStringForFailureType (
 {
   UINTN  Index;

-  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings) - 1; Index++) {
     if (mFailureTypeStrings[Index].Type == Failure) {
       //
       // Return string from matching entry
--
2.17.1





[-- Attachment #2: Type: text/html, Size: 4707 bytes --]

  reply	other threads:[~2020-02-20 21:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20  1:41 [PATCH] UnitTestFrameworkPkg: Invalid index may be used GuoMinJ
2020-02-20 21:39 ` Bret Barkelew [this message]
2020-03-04  7:59 ` [edk2-devel] " Zhang, Shenglei
2020-03-23  5:56   ` Guomin Jiang
2020-03-23 17:32     ` Michael D Kinney
2020-03-24 17:17       ` Bret Barkelew

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR21MB07436C88C773EF7346232E86EF130@CY4PR21MB0743.namprd21.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox