public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData
@ 2020-03-05  5:58 GuoMinJ
  2020-03-23  6:11 ` [edk2-devel] " Guomin Jiang
  0 siblings, 1 reply; 5+ messages in thread
From: GuoMinJ @ 2020-03-05  5:58 UTC (permalink / raw)
  To: devel; +Cc: GuoMinJ, Michael D Kinney, Liming Gao

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: GuoMinJ <newexplorerj@gmail.com>
---
 MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c b/MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c
index 6f7c31cab4..933d2b40e0 100644
--- a/MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c
+++ b/MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c
@@ -252,6 +252,9 @@ RfcDecodeTest(
   BinSize = AsciiStrnLenS (binString, MAX_TEST_STRING_SIZE);
 
   BinData = AllocatePool (BinSize);
+  if (BinData == NULL) {
+    return UNIT_TEST_ERROR_TEST_FAILED;
+  }
   Btc->BufferToFree = BinData;
 
   ReturnSize = BinSize;
-- 
2.17.1


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

end of thread, other threads:[~2020-03-23 21:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-05  5:58 [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData GuoMinJ
2020-03-23  6:11 ` [edk2-devel] " Guomin Jiang
2020-03-23 13:33   ` Liming Gao
2020-03-23 18:16     ` Michael D Kinney
2020-03-23 21:54       ` Bret Barkelew

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