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 <[email protected]>
Cc: Michael D Kinney <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Andrew Fish <[email protected]>
---
 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

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to