From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "Jiang, Guomin" <guomin.jiang@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>,
"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH v4] MdePkg/UnitTestBaseLib: Add check for pointer BinData
Date: Tue, 24 Mar 2020 15:52:31 +0000 [thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F5B9EEE26E@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <20200324014241.194-1-guomin.jiang@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Mike
> -----Original Message-----
> From: Jiang, Guomin <guomin.jiang@intel.com>
> Sent: Monday, March 23, 2020 6:43 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>;
> Gao, Liming <liming.gao@intel.com>
> Subject: [PATCH v4] 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: Guomin Jiang <guomin.jiang@intel.com>
> ---
> 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 = AsciiStrnLenS (binString,
> MAX_TEST_STRING_SIZE);
>
>
>
> BinData = AllocatePool (BinSize);
>
> - Btc->BufferToFree = BinData;
>
> + UT_ASSERT_NOT_NULL(BinData);
>
>
>
> + Btc->BufferToFree = BinData;
>
> ReturnSize = BinSize;
>
> +
>
> Status = Base64Decode (b64String, b64StringLen,
> BinData, &ReturnSize);
>
>
>
> UT_ASSERT_STATUS_EQUAL (Status, Btc-
> >ExpectedStatus);
>
> --
> 2.25.1.windows.1
next prev parent reply other threads:[~2020-03-24 15:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-24 1:42 [PATCH v4] MdePkg/UnitTestBaseLib: Add check for pointer BinData Guomin Jiang
2020-03-24 15:52 ` Michael D Kinney [this message]
2020-03-24 17:38 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E92EE9817A31E24EB0585FDF735412F5B9EEE26E@ORSMSX113.amr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox