]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/HiiDatabaseDxe: ASSERT "Private->Attribute >> 4"
authorShenglei Zhang <shenglei.zhang@intel.com>
Tue, 15 Oct 2019 06:27:32 +0000 (14:27 +0800)
committerLiming Gao <liming.gao@intel.com>
Mon, 4 Nov 2019 00:56:06 +0000 (08:56 +0800)
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 <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
MdeModulePkg/Universal/HiiDatabaseDxe/Font.c

index ca63df168c9477e2a7e3cfa784981be0cbf98131..ee6c65287dbb91bb5fd94bdf383f689363cbbb7a 100644 (file)
@@ -999,6 +999,7 @@ GetSystemFont (
   }\r
 \r
   Info->ForegroundColor    = mHiiEfiColors[Private->Attribute & 0x0f];\r
+  ASSERT ((Private->Attribute >> 4) < 8);\r
   Info->BackgroundColor    = mHiiEfiColors[Private->Attribute >> 4];\r
   Info->FontInfoMask       = EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_SYS_STYLE;\r
   Info->FontInfo.FontStyle = 0;\r