From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.1315.1572574255356546168 for ; Thu, 31 Oct 2019 19:10:55 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: dandan.bi@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2019 19:10:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,253,1569308400"; d="scan'208";a="204383206" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga006.jf.intel.com with ESMTP; 31 Oct 2019 19:10:54 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 31 Oct 2019 19:10:54 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 31 Oct 2019 19:10:53 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.215]) with mapi id 14.03.0439.000; Fri, 1 Nov 2019 10:10:52 +0800 From: "Dandan Bi" To: "Zhang, Shenglei" , "devel@edk2.groups.io" CC: "Dong, Eric" Subject: Re: [PATCH v2] MdeModulePkg/HiiDatabaseDxe: Add check for 'Private->Attribute >> 4' Thread-Topic: [PATCH v2] MdeModulePkg/HiiDatabaseDxe: Add check for 'Private->Attribute >> 4' Thread-Index: AQHVjyhSMFUC2sI+0kqEY669dvnJSad1k9vA Date: Fri, 1 Nov 2019 02:10:51 +0000 Message-ID: <3C0D5C461C9E904E8F62152F6274C0BB40C94329@SHSMSX104.ccr.corp.intel.com> References: <20191030134532.31248-1-shenglei.zhang@intel.com> In-Reply-To: <20191030134532.31248-1-shenglei.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: dandan.bi@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Zhang, Shenglei > Sent: Wednesday, October 30, 2019 9:46 PM > To: devel@edk2.groups.io > Cc: Bi, Dandan ; Dong, Eric > Subject: [PATCH v2] MdeModulePkg/HiiDatabaseDxe: Add check for 'Private- > >Attribute >> 4' >=20 > The size of mHiiEfiColors is 16. > mHiiEfiColors[Private->Attribute >> 4] may be out of boundary. > So add a check for that. >=20 > Cc: Dandan Bi > Cc: Eric Dong > Signed-off-by: Shenglei Zhang > --- > v2: Instead of returing value, we add ASSERT to ensure > "Private->Attribute >> 4" is not out of boundary. >=20 > MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c > b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c > index ca63df168c94..1eee5ec76bb0 100644 > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c > @@ -999,6 +999,7 @@ GetSystemFont ( > } >=20 > Info->ForegroundColor =3D mHiiEfiColors[Private->Attribute & 0x0f]; > + ASSERT ((Private->Attribute >> 4) < 16); Hi Shenglei, 1) I think we can add ASSERT ((Private->Attribute >> 4) < 8); here directly= , the reason can refer my comments in V1 patch. 2) And please also update the subject and commit message accordingly. With above comments addressed, Reviewed-by: Dandan Bi Thanks, Dandan > Info->BackgroundColor =3D mHiiEfiColors[Private->Attribute >> 4]; > Info->FontInfoMask =3D EFI_FONT_INFO_SYS_FONT | > EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_SYS_STYLE; > Info->FontInfo.FontStyle =3D 0; > -- > 2.18.0.windows.1