From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 754952118DC50 for ; Thu, 8 Nov 2018 18:44:47 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2018 18:44:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,481,1534834800"; d="scan'208";a="248239319" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 08 Nov 2018 18:44:46 -0800 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 8 Nov 2018 18:44:45 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 8 Nov 2018 18:44:45 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.161]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.117]) with mapi id 14.03.0415.000; Fri, 9 Nov 2018 10:44:43 +0800 From: "Zhu, Yonghong" To: "Gao, Liming" , "edk2-devel@lists.01.org" Thread-Topic: [Patch 1/3] BaseTools: Fix UEFI and Tiano Decompression logic issue Thread-Index: AQHUd78Myqag8aEOA0+wAemhVlAQVKVGvJHw Date: Fri, 9 Nov 2018 02:44:43 +0000 Message-ID: References: <1541721496-13332-1-git-send-email-liming.gao@intel.com> <1541721496-13332-2-git-send-email-liming.gao@intel.com> In-Reply-To: <1541721496-13332-2-git-send-email-liming.gao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch 1/3] BaseTools: Fix UEFI and Tiano Decompression logic issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Nov 2018 02:44:47 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Gao, Liming=20 Sent: Friday, November 09, 2018 7:58 AM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong Subject: [Patch 1/3] BaseTools: Fix UEFI and Tiano Decompression logic issu= e https://bugzilla.tianocore.org/show_bug.cgi?id=3D1317 This is a regression issue caused by 041d89bc0f0119df37a5fce1d0f16495ff9050= 89. In Decode() function, once mOutBuf is fully filled, Decode() should return. Current logic misses the checker of mOutBuf after while() loop. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao Cc: Yonghong Zhu --- BaseTools/Source/C/Common/Decompress.c | 6 ++++++ BaseTools/Source/C/TianoCompress/TianoCompress.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Co= mmon/Decompress.c index 71313b1179..33e0f0d160 100644 --- a/BaseTools/Source/C/Common/Decompress.c +++ b/BaseTools/Source/C/Common/Decompress.c @@ -662,6 +662,12 @@ Returns: (VOID) =20 BytesRemain--; } + // + // Once mOutBuf is fully filled, directly return + // + if (Sd->mOutBuf >=3D Sd->mOrigSize) { + return ; + } } } =20 diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c b/BaseTools/S= ource/C/TianoCompress/TianoCompress.c index 2d6fc4c952..a77f6798ec 100644 --- a/BaseTools/Source/C/TianoCompress/TianoCompress.c +++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c @@ -2682,6 +2682,12 @@ Returns: (VOID) =20 BytesRemain--; } + // + // Once mOutBuf is fully filled, directly return + // + if (Sd->mOutBuf >=3D Sd->mOrigSize) { + goto Done ; + } } } =20 --=20 2.16.2.windows.1