public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] MdePkg: Adjust the loops in PeCoffLoaderGetImageInfo()
@ 2017-08-08  1:13 Yonghong Zhu
  0 siblings, 0 replies; only message in thread
From: Yonghong Zhu @ 2017-08-08  1:13 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Michael D Kinney, Andrew Fish

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-08  1:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-08  1:13 [Patch] MdePkg: Adjust the loops in PeCoffLoaderGetImageInfo() Yonghong Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox