From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mx.groups.io with SMTP id smtpd.web11.7730.1583379667993008100 for ; Wed, 04 Mar 2020 19:41:08 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=I5cSEiwX; spf=pass (domain: gmail.com, ip: 209.85.210.176, mailfrom: newexplorerj@gmail.com) Received: by mail-pf1-f176.google.com with SMTP id y21so2076364pfp.1 for ; Wed, 04 Mar 2020 19:41:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=QPgRlM6bpzXNetTNz1+0hcFhanmTUXag0E/0wycErZ4=; b=I5cSEiwX86600Jsav2/jHvlj9wcs2zPNDh7Jgzsgv+zIagMFO11T/slgusXzKPlpvO jrS12iWikgPqlvaqOOSYcPKV1Ku4/PWV8hPhC5ipJ4c9OwtvpK8gKaBzaTxC2ZJoqnFP sKR68RVq8ZtMpAfZNZ9LC2BaL84diGFXVU+WwSK6KqbhFx8PEOTG3K8wY8HJT870Ncts c9JY0pcTvVDqMW4WsW2xIyM3BFEM8snwLpvGPzmrrZTQ0Da1xzClEEyyX+6qDdeW918u lCYI51/K9bFHEKrejV99ZOtUr1r0Ga9nIrQ0egkMeoH1ivtnTBPGO31hvRMDNXk4oaIf 103g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QPgRlM6bpzXNetTNz1+0hcFhanmTUXag0E/0wycErZ4=; b=MWOaDWcYWeJMOE+Qsb/+kYvzm07qdN/leTUG19bQyo77mkHkm0c5ipb5FGKvGg9YIy Z8Maiuczlu2UZUwiFPzJwZByPbFLCwBqqWuDeXS+uZLhLdLOPqeanln9nx3oWHlJx9hr wV+PVRmh46nYndamLXyNijue6TNravCjDDWfj4Cjr5lmmq1NgBn49qBweIsrKMUdc/9q +BIGnCIf8L8uuq6o7zM+h9ZjfG2dSih+VZL1XxYK46rvW4c3FgoC70hzNQoHYHLsXYsP ZFALCx09Hba7H7u6O1EEYTMHz+8VXP61HTgM1jR8DFXyOPUIOPmNkxabYPyIItQlLmsS bY9w== X-Gm-Message-State: ANhLgQ0H5Cd9uD8DVul6Tn7b8x+SAQcdWXV8xBCC0fgG/w8dQxHAVsh8 3ziLeJQ7veewMrdJSIb0GqBryStAoV3JHg== X-Google-Smtp-Source: ADFU+vs4ehoDpaF5rGVvqc3lywdPCS9NQnDdRTnKM63Wn26WpehN/t5xeaDo82gg6iBU40HYErpKEA== X-Received: by 2002:a63:7f14:: with SMTP id a20mr329010pgd.428.1583379667009; Wed, 04 Mar 2020 19:41:07 -0800 (PST) Return-Path: Received: from localhost.localdomain ([222.67.15.87]) by smtp.gmail.com with ESMTPSA id a7sm4043725pjo.11.2020.03.04.19.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 19:41:06 -0800 (PST) From: "GuoMinJ" To: devel@edk2.groups.io Cc: GuoMinJ , Michael D Kinney , Liming Gao Subject: [PATCH v2] MdePkg/UnitTestBaseLib: Pointer BinData need to be checked Date: Thu, 5 Mar 2020 11:40:07 +0800 Message-Id: <8826d6055406855f0fff1ab10515f6182ae10616.1583379517.git.newexplorerj@gmail.com> X-Mailer: git-send-email 2.17.1 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 Cc: Liming Gao Signed-off-by: GuoMinJ --- 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