mirror of https://github.com/acidanthera/audk.git
UnitTestFrameworkPkg/UnitTestLib: Check Suite pointer before use.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2530 The Suite pointer is used before check if it is valid, correct it to check the validation before use. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: GuoMinJ <newexplorerj@gmail.com> Reviewed-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
This commit is contained in:
parent
090e267b5b
commit
5bc09cf05a
|
@ -33,13 +33,13 @@ RunTestSuite (
|
||||||
UNIT_TEST *Test;
|
UNIT_TEST *Test;
|
||||||
UNIT_TEST_FRAMEWORK *ParentFramework;
|
UNIT_TEST_FRAMEWORK *ParentFramework;
|
||||||
|
|
||||||
TestEntry = NULL;
|
|
||||||
ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
|
|
||||||
|
|
||||||
if (Suite == NULL) {
|
if (Suite == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TestEntry = NULL;
|
||||||
|
ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
|
||||||
|
|
||||||
DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
|
DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
|
||||||
DEBUG ((DEBUG_VERBOSE, "RUNNING TEST SUITE: %a\n", Suite->Title));
|
DEBUG ((DEBUG_VERBOSE, "RUNNING TEST SUITE: %a\n", Suite->Title));
|
||||||
DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
|
DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
|
||||||
|
|
|
@ -436,7 +436,6 @@ AddTestCase (
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
Suite = (UNIT_TEST_SUITE *)SuiteHandle;
|
Suite = (UNIT_TEST_SUITE *)SuiteHandle;
|
||||||
ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// First, let's check to make sure that our parameters look good.
|
// First, let's check to make sure that our parameters look good.
|
||||||
|
@ -445,6 +444,7 @@ AddTestCase (
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
|
||||||
//
|
//
|
||||||
// Create the new entry.
|
// Create the new entry.
|
||||||
NewTestEntry = AllocateZeroPool (sizeof( UNIT_TEST_LIST_ENTRY ));
|
NewTestEntry = AllocateZeroPool (sizeof( UNIT_TEST_LIST_ENTRY ));
|
||||||
|
|
Loading…
Reference in New Issue