From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.47168.1584943922461164401 for ; Sun, 22 Mar 2020 23:12:02 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: guomin.jiang@intel.com) IronPort-SDR: 828yG+vj2eR2SEx3jj3IQCHPo3D1nBHnb8cy2/qRez5z+VapL0eOLHu5TGC5m/WMWRDRI3QplH x4zHbX/VJKXw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2020 23:12:02 -0700 IronPort-SDR: xHCkb9Es01kg0oFi5U+R0qZwyikFpWZnjDK8q77Ky6uQlxSSP9uOCLE20lj497wZW9IDQnUSjM lG0IgEW3pVeQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,295,1580803200"; d="scan'208";a="392803109" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 22 Mar 2020 23:12:01 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 22 Mar 2020 23:12:01 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 22 Mar 2020 23:12:01 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.43]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.201]) with mapi id 14.03.0439.000; Mon, 23 Mar 2020 14:11:58 +0800 From: "Guomin Jiang" To: "devel@edk2.groups.io" , "newexplorerj@gmail.com" CC: "Kinney, Michael D" , "Gao, Liming" Subject: Re: [edk2-devel] [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData Thread-Topic: [edk2-devel] [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData Thread-Index: AQHV8rNFTwW7VLSMwEynwM4wuDxOrKhVzkfg Date: Mon, 23 Mar 2020 06:11:57 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: guomin.jiang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Michael, Liming, Could you help review the patch. Thanks. > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > GuoMinJ > Sent: Thursday, March 5, 2020 1:58 PM > To: devel@edk2.groups.io > Cc: GuoMinJ ; Kinney, Michael D > ; Gao, Liming > Subject: [edk2-devel] [PATCH v3] MdePkg/UnitTestBaseLib: Add check for > pointer BinData >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2531 >=20 > AllocatePool may fail and BinData may be invalid, check it before use. >=20 > Cc: Michael D Kinney > Cc: Liming Gao > Signed-off-by: GuoMinJ > --- > MdePkg/Test/UnitTest/Library/BaseLib/Base64UnitTest.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > 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 =3D AsciiStrnLenS (binString, MAX_TEST_STRING_SIZE); >=20 > BinData =3D AllocatePool (BinSize); > + if (BinData =3D=3D NULL) { > + return UNIT_TEST_ERROR_TEST_FAILED; } > Btc->BufferToFree =3D BinData; >=20 > ReturnSize =3D BinSize; > -- > 2.17.1 >=20 >=20 >=20