public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UnitTestFrameworkPkg: Invalid index may be used.
@ 2020-02-20  1:41 GuoMinJ
  2020-02-20 21:39 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
  2020-03-04  7:59 ` Zhang, Shenglei
  0 siblings, 2 replies; 6+ messages in thread
From: GuoMinJ @ 2020-02-20  1:41 UTC (permalink / raw)
  To: devel; +Cc: GuoMinJ

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2535

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-24 17:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-20  1:41 [PATCH] UnitTestFrameworkPkg: Invalid index may be used GuoMinJ
2020-02-20 21:39 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-03-04  7:59 ` Zhang, Shenglei
2020-03-23  5:56   ` Guomin Jiang
2020-03-23 17:32     ` Michael D Kinney
2020-03-24 17:17       ` Bret Barkelew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox