public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Andrew Fish <afish@apple.com>
Subject: [Patch] MdePkg: Adjust the loops in PeCoffLoaderGetImageInfo()
Date: Tue,  8 Aug 2017 09:13:29 +0800	[thread overview]
Message-ID: <1502154809-32212-1-git-send-email-yonghong.zhu@intel.com> (raw)

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 <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Andrew Fish <afish@apple.com>
---
 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



                 reply	other threads:[~2017-08-08  1:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502154809-32212-1-git-send-email-yonghong.zhu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox