From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E5722821EB for ; Mon, 20 Feb 2017 03:11:16 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2017 03:11:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,186,1484035200"; d="scan'208";a="60416705" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 20 Feb 2017 03:11:16 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 20 Feb 2017 03:11:16 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 20 Feb 2017 03:11:15 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0248.002; Mon, 20 Feb 2017 19:11:14 +0800 From: "Dong, Eric" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: Wang Cloud , "Gao, Liming" Thread-Topic: [edk2] [patch] MdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText" Thread-Index: AQHSg0U4O6TtQM9+WUKU2m6o+bOqw5Y6ehnw Date: Mon, 20 Feb 2017 11:11:13 +0000 Message-ID: References: <1486693530-222908-1-git-send-email-dandan.bi@intel.com> In-Reply-To: <1486693530-222908-1-git-send-email-dandan.bi@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 Subject: Re: [patch] MdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText" X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Feb 2017 11:11:17 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Da= ndan Bi > Sent: Friday, February 10, 2017 10:26 AM > To: edk2-devel@lists.01.org > Cc: Wang Cloud; Dong, Eric; Gao, Liming > Subject: [edk2] [patch] MdeMoudlePkg/DisplayEngine: Fix incorrect index u= sed in array "InputText" >=20 > When set value to the array "InputText", the index was used incorrectly. > And the array "InputText" is not initialized. These will cause some value > in the array is random, so it will be shown incorrectly sometimes. > This patch is to fix this issue. >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D358 >=20 > Cc: Eric Dong > Cc: Liming Gao > Cc: Wang Cloud > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Dandan Bi > --- > .../Universal/DisplayEngineDxe/InputHandler.c | 33 ++++++++++++----= ------ > 1 file changed, 18 insertions(+), 15 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c b/Mde= ModulePkg/Universal/DisplayEngineDxe/InputHandler.c > index 400b934..d02c0bf 100644 > --- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c > +++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c > @@ -1,9 +1,9 @@ > /** @file > Implementation for handling user input from the User Interfaces. >=20 > -Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D License > which accompanies this distribution. The full text of the license may b= e found at > http://opensource.org/licenses/bsd-license.php >=20 > @@ -522,10 +522,11 @@ GetNumericInput ( > Negative =3D FALSE; > ValidateFail =3D FALSE; >=20 > Question =3D MenuOption->ThisTag; > QuestionValue =3D &Question->CurrentValue; > + ZeroMem (InputText, MAX_NUMERIC_INPUT_WIDTH * sizeof (CHAR16)); >=20 > // > // Only two case, user can enter to this function: Enter and +/- case. > // In Enter case, gDirection =3D 0; in +/- case, gDirection =3D SCAN_L= EFT/SCAN_WRIGHT > // > @@ -688,20 +689,21 @@ GetNumericInput ( > } >=20 > if (MenuOption->Sequence =3D=3D 0) { > InputText[0] =3D LEFT_NUMERIC_DELIMITER; > SetUnicodeMem (InputText + 1, InputWidth, L' '); > - } else { > + InputText[InputWidth + 1] =3D DATE_SEPARATOR; > + InputText[InputWidth + 2] =3D L'\0'; > + } else if (MenuOption->Sequence =3D=3D 1){ > SetUnicodeMem (InputText, InputWidth, L' '); > - } > - > - if (MenuOption->Sequence =3D=3D 2) { > - InputText[InputWidth + 1] =3D RIGHT_NUMERIC_DELIMITER; > + InputText[InputWidth] =3D DATE_SEPARATOR; > + InputText[InputWidth + 1] =3D L'\0'; > } else { > - InputText[InputWidth + 1] =3D DATE_SEPARATOR; > + SetUnicodeMem (InputText, InputWidth, L' '); > + InputText[InputWidth] =3D RIGHT_NUMERIC_DELIMITER; > + InputText[InputWidth + 1] =3D L'\0'; > } > - InputText[InputWidth + 2] =3D L'\0'; >=20 > PrintStringAt (Column, Row, InputText); > if (MenuOption->Sequence =3D=3D 0) { > Column++; > } > @@ -711,20 +713,21 @@ GetNumericInput ( > InputWidth =3D 2; >=20 > if (MenuOption->Sequence =3D=3D 0) { > InputText[0] =3D LEFT_NUMERIC_DELIMITER; > SetUnicodeMem (InputText + 1, InputWidth, L' '); > - } else { > + InputText[InputWidth + 1] =3D TIME_SEPARATOR; > + InputText[InputWidth + 2] =3D L'\0'; > + } else if (MenuOption->Sequence =3D=3D 1){ > SetUnicodeMem (InputText, InputWidth, L' '); > - } > - > - if (MenuOption->Sequence =3D=3D 2) { > - InputText[InputWidth + 1] =3D RIGHT_NUMERIC_DELIMITER; > + InputText[InputWidth] =3D TIME_SEPARATOR; > + InputText[InputWidth + 1] =3D L'\0'; > } else { > - InputText[InputWidth + 1] =3D TIME_SEPARATOR; > + SetUnicodeMem (InputText, InputWidth, L' '); > + InputText[InputWidth] =3D RIGHT_NUMERIC_DELIMITER; > + InputText[InputWidth + 1] =3D L'\0'; > } > - InputText[InputWidth + 2] =3D L'\0'; >=20 > PrintStringAt (Column, Row, InputText); > if (MenuOption->Sequence =3D=3D 0) { > Column++; > } > -- > 1.9.5.msysgit.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel