From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,340,1498546800"; d="scan'208";a="121060565" 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 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: Liming Gao , Michael D Kinney , Andrew Fish 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: [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: , X-List-Received-Date: Tue, 08 Aug 2017 01:11:17 -0000 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=663 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/BasePeCoffLib/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 == 0 && DebugEntry.FileOffset != 0) { ImageContext->ImageSize += DebugEntry.SizeOfData; } return RETURN_SUCCESS; + } else if (DebugEntry.Type == CODEVIEW_SIGNATURE_MTOC) { + return RETURN_SUCCESS; } } } } } else { @@ -860,10 +862,12 @@ PeCoffLoaderGetImageInfo ( } if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) { ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index); return RETURN_SUCCESS; + } else if (DebugEntry.Type == CODEVIEW_SIGNATURE_MTOC) { + return RETURN_SUCCESS; } } } } -- 2.6.1.windows.1