From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mx.groups.io with SMTP id smtpd.web09.20691.1628502715450253867 for ; Mon, 09 Aug 2021 02:51:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=cVj+FZED; spf=pass (domain: posteo.de, ip: 185.67.36.66, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 92355240106 for ; Mon, 9 Aug 2021 11:51:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1628502713; bh=/BqRpbSJJCJ/4MbrtHMq7ZvhYE6GS3dc1opXnMzCszg=; h=From:To:Cc:Subject:Date:From; b=cVj+FZEDe+Qozy3WRdkf5s0AWZUxctVnXzAumjLSS25FvKMgsuCjIcDbHZj7fy02a b21EokG/GjQOI+QveKu9qGwkkdD08nZEq0Ms/LpQZ4d6SOZ/6y/8Boin6w/6MRu0x1 cU5DB4Lnf3PHHuYxXzXY5K7co1rELk6j+PkC3IpX2jR2UdsXxowv//cRVsOJBxwKGZ VxeRCRCVcN3ZP5HKbVoEK+Cet9sz0ECtXsczFPeWPINhtHUNyJbqj5Yel3by0BumVV SNZjlKfJ3V1lIO75XVnBUP+K0XlNy2P4Xd2u2Q5ruGgfjcDp7rcYwFv2+xiEjXR7ta +8wvWu9MCzsFg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Gjrvs1B8zz6tmF; Mon, 9 Aug 2021 11:51:53 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Vitaly Cheptsov Subject: [PATCH v2 4/7] ArmPkg/DefaultExceptionHandlerLib: Check DebugImageInfoTable type safely Date: Mon, 9 Aug 2021 09:51:29 +0000 Message-Id: <961f3436a2b52a67aa6c8cd45c75c76835a3a5d8.1628502345.git.mhaeuser@posteo.de> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable C does not allow casting to or dereferencing incompatible pointer types. Use the ImageInfoType member of the union first to determine the data type before dereferencing NormalImage. Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c | = 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHand= lerUefi.c b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandl= erUefi.c index e9fea4038252..9befb6d4db9b 100644 --- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi= .c +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi= .c @@ -51,8 +51,8 @@ GetImageName ( =0D Address =3D (CHAR8 *)(UINTN)FaultAddress;=0D for (Entry =3D 0; Entry < DebugTableHeader->TableSize; Entry++, DebugTab= le++) {=0D - if (DebugTable->NormalImage !=3D NULL) {=0D - if ((DebugTable->NormalImage->ImageInfoType =3D=3D EFI_DEBUG_IMAGE_I= NFO_TYPE_NORMAL) &&=0D + if (DebugTable->ImageInfoType !=3D NULL) {=0D + if ((*DebugTable->ImageInfoType =3D=3D EFI_DEBUG_IMAGE_INFO_TYPE_NOR= MAL) &&=0D (DebugTable->NormalImage->LoadedImageProtocolInstance !=3D NULL)= ) {=0D if ((Address >=3D (CHAR8 *)DebugTable->NormalImage->LoadedImagePro= tocolInstance->ImageBase) &&=0D (Address <=3D ((CHAR8 *)DebugTable->NormalImage->LoadedImagePr= otocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolIns= tance->ImageSize))) {=0D --=20 2.31.1