[EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.

Bret Barkelew via Groups.Io bret.barkelew=microsoft.com at groups.io
Thu Feb 20 21:39:13 UTC 2020


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

- Bret

________________________________
From: devel at edk2.groups.io <devel at edk2.groups.io> on behalf of GuoMinJ via Groups.Io <newexplorerj=gmail.com at groups.io>
Sent: Wednesday, February 19, 2020 5:41:56 PM
To: devel at edk2.groups.io <devel at edk2.groups.io>
Cc: GuoMinJ <newexplorerj at 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&data=02%7C01%7CBret.Barkelew%40microsoft.com%7C49deda8899264bfbb32108d7b5a66f87%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637177598752484898&sdata=WySGg%2BbeLnDDt98xRUOhjGd1DkNyU5m8HiRInsVKm4Q%3D&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 at 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





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54685): https://edk2.groups.io/g/devel/message/54685
Mute This Topic: https://groups.io/mt/71438622/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20200220/33b2fa9a/attachment.htm>


More information about the edk2-devel-archive mailing list