To make parsing DebugImageInfoTable easier and safer, require the
LoadedImage protocol instance to be valid for every NormalImage
entry.

Cc: Leif Lindholm <l...@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org>
Cc: Vitaly Cheptsov <vit9...@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeu...@posteo.de>
---
 ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c | 5 
+++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c 
b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
index 9befb6d4db9b..d442b5d358b2 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
@@ -52,8 +52,9 @@ GetImageName (
   Address = (CHAR8 *)(UINTN)FaultAddress;

   for (Entry = 0; Entry < DebugTableHeader->TableSize; Entry++, DebugTable++) {

     if (DebugTable->ImageInfoType != NULL) {

-      if ((*DebugTable->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&

-          (DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {

+      if (*DebugTable->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) {

+        ASSERT (gDebugTable->NormalImage->LoadedImageProtocolInstance != NULL);

+

         if ((Address >= (CHAR8 
*)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase) &&

             (Address <= ((CHAR8 
*)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase + 
DebugTable->NormalImage->LoadedImageProtocolInstance->ImageSize))) {

           *ImageBase = 
(UINTN)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;

-- 
2.31.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78948): https://edk2.groups.io/g/devel/message/78948
Mute This Topic: https://groups.io/mt/84764911/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to