public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zhang, Shenglei" <shenglei.zhang@intel.com>
To: devel@edk2.groups.io
Cc: Dandan Bi <dandan.bi@intel.com>, Eric Dong <eric.dong@intel.com>
Subject: [PATCH] MdeModulePkg/HiiDatabaseDxe: Add check for 'Private->Attribute >> 4'
Date: Thu, 17 Oct 2019 14:21:10 +0800	[thread overview]
Message-ID: <20191017062111.10568-1-shenglei.zhang@intel.com> (raw)

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


             reply	other threads:[~2019-10-17  6:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17  6:21 Zhang, Shenglei [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191017062111.10568-1-shenglei.zhang@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox