public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/HiiDatabaseDxe: Add check for 'Private->Attribute >> 4'
@ 2019-10-17  6:21 Zhang, Shenglei
  2019-10-17  6:21 ` [PATCH] MdeModulePkg/SdBlockIoPei: Add check for DeviceIndex Zhang, Shenglei
  2019-10-18  2:53 ` [edk2-devel] [PATCH] MdeModulePkg/HiiDatabaseDxe: Add check for 'Private->Attribute >> 4' Dandan Bi
  0 siblings, 2 replies; 5+ messages in thread
From: Zhang, Shenglei @ 2019-10-17  6:21 UTC (permalink / raw)
  To: devel; +Cc: Dandan Bi, Eric Dong

The size of mHiiEfiColors is 16.
mHiiEfiColors[Private->Attribute >> 4] may be out of boundary.
So add a check for that.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
index ca63df168c94..282a7a114d17 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
@@ -999,7 +999,12 @@ GetSystemFont (
   }
 
   Info->ForegroundColor    = mHiiEfiColors[Private->Attribute & 0x0f];
-  Info->BackgroundColor    = mHiiEfiColors[Private->Attribute >> 4];
+  if ((Private->Attribute >> 4) < 16){
+    Info->BackgroundColor    = mHiiEfiColors[Private->Attribute >> 4];
+  } else {
+    return EFI_INVALID_PARAMETER;
+  }
+  
   Info->FontInfoMask       = EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_SYS_STYLE;
   Info->FontInfo.FontStyle = 0;
   Info->FontInfo.FontSize  = EFI_GLYPH_HEIGHT;
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-30  7:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-17  6:21 [PATCH] MdeModulePkg/HiiDatabaseDxe: Add check for 'Private->Attribute >> 4' Zhang, Shenglei
2019-10-17  6:21 ` [PATCH] MdeModulePkg/SdBlockIoPei: Add check for DeviceIndex Zhang, Shenglei
2019-10-30  7:14   ` [edk2-devel] " Wu, Hao A
2019-10-30  7:53     ` Zhang, Shenglei
2019-10-18  2:53 ` [edk2-devel] [PATCH] MdeModulePkg/HiiDatabaseDxe: Add check for 'Private->Attribute >> 4' Dandan Bi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox