From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web10.4054.1585014164286193891 for ; Mon, 23 Mar 2020 18:42:44 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: guomin.jiang@intel.com) IronPort-SDR: sgC4y02cRNvw60eVqejKBTMVcf/TjuD5Db1WlLdb/HqSDZJLQ2gdtUYoQw0RnzvBimCVa3UD8D rPddUz4E6zNA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 18:42:43 -0700 IronPort-SDR: LpwggZ6A59dss6is2DO5k4s2+xaiBxwusRRt+/smMuWJ39/9nraiAZ9sbzekiM/LW5sx1wg2XI OnYEAevFLtYA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,298,1580803200"; d="scan'208";a="447712949" Received: from guominji-mobl.ccr.corp.intel.com ([10.238.5.173]) by fmsmga006.fm.intel.com with ESMTP; 23 Mar 2020 18:42:41 -0700 From: "Guomin Jiang" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao Subject: [PATCH v4] MdePkg/UnitTestBaseLib: Add check for pointer BinData Date: Tue, 24 Mar 2020 09:42:41 +0800 Message-Id: <20200324014241.194-1-guomin.jiang@intel.com> X-Mailer: git-send-email 2.25.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2531 AllocatePool may fail and BinData may be invalid, check it before use. Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Guomin Jiang --- MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 =3D AsciiStrnLenS (binString, MAX_TEST_STRING_SIZE);=0D =0D BinData =3D AllocatePool (BinSize);=0D - Btc->BufferToFree =3D BinData;=0D + UT_ASSERT_NOT_NULL(BinData);=0D =0D + Btc->BufferToFree =3D BinData;=0D ReturnSize =3D BinSize;=0D +=0D Status =3D Base64Decode (b64String, b64StringLen, BinData, &ReturnSize);= =0D =0D UT_ASSERT_STATUS_EQUAL (Status, Btc->ExpectedStatus);=0D --=20 2.25.1.windows.1