From nobody Sun May 5 14:05:49 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502154817216598.4613325367234; Mon, 7 Aug 2017 18:13:37 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5015621DFE913; Mon, 7 Aug 2017 18:11:19 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 373F121DF9696 for ; Mon, 7 Aug 2017 18:11:17 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2017 18:13:33 -0700 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by orsmga002.jf.intel.com with ESMTP; 07 Aug 2017 18:13:32 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,340,1498546800"; d="scan'208";a="121060565" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Tue, 8 Aug 2017 09:13:29 +0800 Message-Id: <1502154809-32212-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] MdePkg: Adjust the loops in PeCoffLoaderGetImageInfo() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney , Andrew Fish , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It looks like mtoc images will iterate in this loop and reload the .debug section sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) ImageContext->ImageRead() in the loop. Bail out after the 1st read (it is already in the .debug section). Fixes:https://bugzilla.tianocore.org/show_bug.cgi?id=3D663 Cc: Liming Gao Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Andrew Fish --- MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/Bas= ePeCoffLib/BasePeCoff.c index 8d1daba..423d95f 100644 --- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c @@ -769,10 +769,12 @@ PeCoffLoaderGetImageInfo ( if (DebugEntry.RVA =3D=3D 0 && DebugEntry.FileOffset !=3D 0) { ImageContext->ImageSize +=3D DebugEntry.SizeOfData; } =20 return RETURN_SUCCESS; + } else if (DebugEntry.Type =3D=3D CODEVIEW_SIGNATURE_MTOC) { + return RETURN_SUCCESS; } } } } } else { @@ -860,10 +862,12 @@ PeCoffLoaderGetImageInfo ( } =20 if (DebugEntry.Type =3D=3D EFI_IMAGE_DEBUG_TYPE_CODEVIEW) { ImageContext->DebugDirectoryEntryRva =3D (UINT32) (DebugDirector= yEntryRva + Index); return RETURN_SUCCESS; + } else if (DebugEntry.Type =3D=3D CODEVIEW_SIGNATURE_MTOC) { + return RETURN_SUCCESS; } } } } =20 --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel