summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuomin Jiang <guomin.jiang@intel.com>2020-03-24 09:34:20 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-03-27 02:03:41 +0000
commit090e267b5bb594d9f2dbe38b2b3562347773826a (patch)
tree7063d111bc09ff20c1ce3632c16bb0e07e649ef9
parent695d90b9b156573d0dafb20afecea09dc9a914f4 (diff)
downloadedk2-090e267b5bb594d9f2dbe38b2b3562347773826a.tar.gz
edk2-090e267b5bb594d9f2dbe38b2b3562347773826a.tar.bz2
edk2-090e267b5bb594d9f2dbe38b2b3562347773826a.zip
MdePkg/UnitTestBaseLib: Add check for pointer BinData
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2531 AllocatePool may fail and BinData may be invalid, check it before use. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
-rw-r--r--MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c b/MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c
index 6f7c31cab4..8952f9da6c 100644
--- a/MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c
+++ b/MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c
@@ -252,9 +252,11 @@ RfcDecodeTest(
BinSize = AsciiStrnLenS (binString, MAX_TEST_STRING_SIZE);
BinData = AllocatePool (BinSize);
- Btc->BufferToFree = BinData;
+ UT_ASSERT_NOT_NULL(BinData);
+ Btc->BufferToFree = BinData;
ReturnSize = BinSize;
+
Status = Base64Decode (b64String, b64StringLen, BinData, &ReturnSize);
UT_ASSERT_STATUS_EQUAL (Status, Btc->ExpectedStatus);