From nobody Mon Feb 9 00:43:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+48955+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48955+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1571099244; cv=none; d=zoho.com; s=zohoarc; b=GBdIPs0//FsaI9I8hwFEMNryCipTJNtxYQ8ngHkofMY1Xup622n2r5wAcNT1kkIS/kp1coekTe8nCkvpr4zBWT1OKjPt+6aVTJ467/Z4H8QgGnJN0AjlkINCqaTan22c5ZPH4Z95jrPzdq/AHcxJwaLwXi7bDr6duj0UlQ/d+/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571099244; h=Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=ycAuRLhArlq01Fg7mlK9DwvDtlJYnRG/mj/AOURzDhY=; b=Sbzd92JoXyKKA6UOIBhpuOh+x0coGWVB2uan+dtMepoJuabD6Z+Swr2G1SonSznXoOx5atFBKNhx1YkGHooIYtZKOGoPI1nXyRPSBIdusOMqb0DSvcdd2Fs9cwC4b+L9MSfaeX9ptdBf2qECaZrX7eSVMJDm8OsOoa4fm9CGet8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48955+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1571099244040679.0803869102074; Mon, 14 Oct 2019 17:27:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 8DbiYY1788612xaTlMVyWFlE; Mon, 14 Oct 2019 17:27:23 -0700 X-Received: from mga12.intel.com (mga12.intel.com []) by mx.groups.io with SMTP id smtpd.web12.2007.1571099241220744311 for ; Mon, 14 Oct 2019 17:27:23 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Oct 2019 17:27:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,296,1566889200"; d="scan'208";a="194363335" X-Received: from shwde7172.ccr.corp.intel.com ([10.239.158.22]) by fmsmga008.fm.intel.com with ESMTP; 14 Oct 2019 17:27:22 -0700 From: "Liming Gao" To: devel@edk2.groups.io Subject: [edk2-devel] [Patch v2 03/11] BaseTools GenFw: Fix the issue to update the wrong size as SectionSize Date: Tue, 15 Oct 2019 08:26:42 +0800 Message-Id: <1571099210-12432-4-git-send-email-liming.gao@intel.com> In-Reply-To: <1571099210-12432-1-git-send-email-liming.gao@intel.com> References: <1571099210-12432-1-git-send-email-liming.gao@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,liming.gao@intel.com X-Gm-Message-State: PTPdlvqAddT5YHnLMOzg5196x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1571099243; bh=cTmp3JAX8Ra8hi0yULSMGqAmbQCYd533x8D784lI+Zs=; h=Date:From:Reply-To:Subject:To; b=L9q1fMzhM/KQanocy61TZyyG7hrkC8tQFCNDZJ03G0DELIebBGhYX6QtDnQr9xe5uWH U8e9maXuscP1N5nU8maejIxxNFKeak9Ufs9sFdIuU7HVvgyN+Q8HCs7ZsIk+kG5UOC9z+ JkuY9zA9DRFKENUewYZbAUq8XLVCiIxynks= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Liming Gao Reviewed-by: Philippe Mathieu-Daude --- BaseTools/Source/C/GenFw/GenFw.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/Ge= nFw.c index c99782b78e..d8d3360c24 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -653,7 +653,11 @@ PeCoffConvertImageToXip ( // // Make the size of raw data in section header alignment. // - SectionHeader->SizeOfRawData =3D (SectionHeader->Misc.VirtualSize + Pe= Hdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader= .FileAlignment - 1)); + SectionSize =3D (SectionHeader->Misc.VirtualSize + PeHdr->Pe32.Optiona= lHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader.FileAlignment - = 1)); + if (SectionSize < SectionHeader->SizeOfRawData) { + SectionHeader->SizeOfRawData =3D SectionSize; + } + =20 SectionHeader->PointerToRawData =3D SectionHeader->VirtualAddress; } =20 @@ -999,7 +1003,7 @@ Returns: CopyMem ( FileBuffer + SectionHeader->PointerToRawData, (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualA= ddress), - SectionHeader->SizeOfRawData + SectionHeader->SizeOfRawData < SectionHeader->Misc.VirtualSize ? Sec= tionHeader->SizeOfRawData : SectionHeader->Misc.VirtualSize ); } =20 --=20 2.13.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#48955): https://edk2.groups.io/g/devel/message/48955 Mute This Topic: https://groups.io/mt/34540584/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-