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 <[email protected]>
> Sent: Monday, March 23, 2020 6:34 AM
> To: Jiang, Guomin <[email protected]>;
> [email protected]; [email protected]
> Cc: Kinney, Michael D <[email protected]>
> Subject: RE: [edk2-devel] [PATCH v3]
> MdePkg/UnitTestBaseLib: Add check for pointer BinData
> 
> Guomin:
>   The change is ok to me. Reviewed-by: Liming Gao
> <[email protected]>
> 
> Thanks
> Liming
> > -----Original Message-----
> > From: Jiang, Guomin <[email protected]>
> > Sent: Monday, March 23, 2020 2:12 PM
> > To: [email protected]; [email protected]
> > Cc: Kinney, Michael D <[email protected]>;
> Gao, Liming <[email protected]>
> > 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: [email protected]
> [mailto:[email protected]] On Behalf Of
> > > GuoMinJ
> > > Sent: Thursday, March 5, 2020 1:58 PM
> > > To: [email protected]
> > > Cc: GuoMinJ <[email protected]>; Kinney,
> Michael D
> > > <[email protected]>; Gao, Liming
> <[email protected]>
> > > 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 <[email protected]>
> > > Cc: Liming Gao <[email protected]>
> > > Signed-off-by: GuoMinJ <[email protected]>
> > > ---
> > >
> 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
> > >
> > >
> > > 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56115): https://edk2.groups.io/g/devel/message/56115
Mute This Topic: https://groups.io/mt/71744132/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to