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...@intel.com> Cc: Eric Dong <eric.d...@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zh...@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 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#49153): https://edk2.groups.io/g/devel/message/49153 Mute This Topic: https://groups.io/mt/34685172/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-