From df50c2fcd85e24cbece9f03f2879fdcc96096ab1 Mon Sep 17 00:00:00 2001 From: Shenglei Zhang Date: Tue, 15 Oct 2019 14:27:32 +0800 Subject: [PATCH] MdeModulePkg/HiiDatabaseDxe: ASSERT "Private->Attribute >> 4" Foreground and background color are saved in a single byte. Bits 0..3 are the foreground color and bits 4..6 are the background color. If the Private->Attribute defined correctly, (Private->Attribute >> 4) must be less than 8. This commit uses ASSERT to assume "Attribute >> 4" is less than 8. Cc: Dandan Bi Cc: Eric Dong Signed-off-by: Shenglei Zhang Reviewed-by: Dandan Bi --- MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 1 + 1 file changed, 1 insertion(+) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c index ca63df168c..ee6c65287d 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c @@ -999,6 +999,7 @@ GetSystemFont ( } Info->ForegroundColor = mHiiEfiColors[Private->Attribute & 0x0f]; + ASSERT ((Private->Attribute >> 4) < 8); Info->BackgroundColor = mHiiEfiColors[Private->Attribute >> 4]; Info->FontInfoMask = EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_SYS_STYLE; Info->FontInfo.FontStyle = 0; -- 2.39.2