* [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
* Re: [edk2-devel] [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData 2020-03-05 5:58 [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData GuoMinJ @ 2020-03-23 6:11 ` Guomin Jiang 2020-03-23 13:33 ` Liming Gao 0 siblings, 1 reply; 5+ messages in thread From: Guomin Jiang @ 2020-03-23 6:11 UTC (permalink / raw) To: devel@edk2.groups.io, newexplorerj@gmail.com Cc: Kinney, Michael D, Gao, Liming 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 <newexplorerj@gmail.com>; Kinney, Michael D > <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com> > Subject: [edk2-devel] [PATCH v3] 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: 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 [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData 2020-03-23 6:11 ` [edk2-devel] " Guomin Jiang @ 2020-03-23 13:33 ` Liming Gao 2020-03-23 18:16 ` Michael D Kinney 0 siblings, 1 reply; 5+ messages in thread From: Liming Gao @ 2020-03-23 13:33 UTC (permalink / raw) To: Jiang, Guomin, devel@edk2.groups.io, newexplorerj@gmail.com Cc: Kinney, Michael D Guomin: The change is ok to me. Reviewed-by: Liming Gao <liming.gao@intel.com> Thanks Liming > -----Original Message----- > From: Jiang, Guomin <guomin.jiang@intel.com> > Sent: Monday, March 23, 2020 2:12 PM > To: devel@edk2.groups.io; newexplorerj@gmail.com > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com> > Subject: RE: [edk2-devel] [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData > > 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 <newexplorerj@gmail.com>; Kinney, Michael D > > <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com> > > Subject: [edk2-devel] [PATCH v3] 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: 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 [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData 2020-03-23 13:33 ` Liming Gao @ 2020-03-23 18:16 ` Michael D Kinney 2020-03-23 21:54 ` Bret Barkelew 0 siblings, 1 reply; 5+ messages in thread From: Michael D Kinney @ 2020-03-23 18:16 UTC (permalink / raw) To: Gao, Liming, Jiang, Guomin, devel@edk2.groups.io, newexplorerj@gmail.com, Kinney, Michael D Guomin, In the function RfcEncodeTest() above, the following code is used to make sure an allocated buffer is not NULL. b64WorkString = (CHAR8 *) AllocatePool(b64StringSize); UT_ASSERT_NOT_NULL(b64WorkString); We should use the same style in both functions. Thanks, Mike > -----Original Message----- > From: Gao, Liming <liming.gao@intel.com> > Sent: Monday, March 23, 2020 6:34 AM > To: Jiang, Guomin <guomin.jiang@intel.com>; > devel@edk2.groups.io; newexplorerj@gmail.com > Cc: Kinney, Michael D <michael.d.kinney@intel.com> > Subject: RE: [edk2-devel] [PATCH v3] > MdePkg/UnitTestBaseLib: Add check for pointer BinData > > Guomin: > The change is ok to me. Reviewed-by: Liming Gao > <liming.gao@intel.com> > > Thanks > Liming > > -----Original Message----- > > From: Jiang, Guomin <guomin.jiang@intel.com> > > Sent: Monday, March 23, 2020 2:12 PM > > To: devel@edk2.groups.io; newexplorerj@gmail.com > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; > Gao, Liming <liming.gao@intel.com> > > Subject: RE: [edk2-devel] [PATCH v3] > MdePkg/UnitTestBaseLib: Add check for pointer BinData > > > > 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 <newexplorerj@gmail.com>; Kinney, > Michael D > > > <michael.d.kinney@intel.com>; Gao, Liming > <liming.gao@intel.com> > > > Subject: [edk2-devel] [PATCH v3] > 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: 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 [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData 2020-03-23 18:16 ` Michael D Kinney @ 2020-03-23 21:54 ` Bret Barkelew 0 siblings, 0 replies; 5+ messages in thread From: Bret Barkelew @ 2020-03-23 21:54 UTC (permalink / raw) To: devel@edk2.groups.io, Kinney, Michael D, Gao, Liming, Jiang, Guomin, newexplorerj@gmail.com [-- Attachment #1: Type: text/plain, Size: 3700 bytes --] Agree. - Bret ________________________________ From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Michael D Kinney via Groups.Io <michael.d.kinney=intel.com@groups.io> Sent: Monday, March 23, 2020 11:16:15 AM To: Gao, Liming <liming.gao@intel.com>; Jiang, Guomin <guomin.jiang@intel.com>; devel@edk2.groups.io <devel@edk2.groups.io>; newexplorerj@gmail.com <newexplorerj@gmail.com>; Kinney, Michael D <michael.d.kinney@intel.com> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v3] MdePkg/UnitTestBaseLib: Add check for pointer BinData Guomin, In the function RfcEncodeTest() above, the following code is used to make sure an allocated buffer is not NULL. b64WorkString = (CHAR8 *) AllocatePool(b64StringSize); UT_ASSERT_NOT_NULL(b64WorkString); We should use the same style in both functions. Thanks, Mike > -----Original Message----- > From: Gao, Liming <liming.gao@intel.com> > Sent: Monday, March 23, 2020 6:34 AM > To: Jiang, Guomin <guomin.jiang@intel.com>; > devel@edk2.groups.io; newexplorerj@gmail.com > Cc: Kinney, Michael D <michael.d.kinney@intel.com> > Subject: RE: [edk2-devel] [PATCH v3] > MdePkg/UnitTestBaseLib: Add check for pointer BinData > > Guomin: > The change is ok to me. Reviewed-by: Liming Gao > <liming.gao@intel.com> > > Thanks > Liming > > -----Original Message----- > > From: Jiang, Guomin <guomin.jiang@intel.com> > > Sent: Monday, March 23, 2020 2:12 PM > > To: devel@edk2.groups.io; newexplorerj@gmail.com > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; > Gao, Liming <liming.gao@intel.com> > > Subject: RE: [edk2-devel] [PATCH v3] > MdePkg/UnitTestBaseLib: Add check for pointer BinData > > > > 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 <newexplorerj@gmail.com>; Kinney, > Michael D > > > <michael.d.kinney@intel.com>; Gao, Liming > <liming.gao@intel.com> > > > Subject: [edk2-devel] [PATCH v3] > MdePkg/UnitTestBaseLib: Add check for > > > pointer BinData > > > > > > REF: > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2531&data=02%7C01%7Cbret.barkelew%40microsoft.com%7C238d3abd482e45ac697708d7cf564945%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637205841811948950&sdata=4I%2B8toPls61MZnTLofea5pjkiC%2Bqnt3uG6j2HYHhORA%3D&reserved=0 > > > > > > 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 > > > > > > > > > [-- Attachment #2: Type: text/html, Size: 6932 bytes --] ^ permalink raw reply [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