From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 9E5D481EE0 for ; Thu, 16 Feb 2017 17:20:10 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 16 Feb 2017 17:20:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,170,1484035200"; d="scan'208";a="59381838" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 16 Feb 2017 17:20:10 -0800 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 16 Feb 2017 17:20:10 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 16 Feb 2017 17:20:09 -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; Fri, 17 Feb 2017 09:20:07 +0800 From: "Bi, Dandan" To: Wang Cloud , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Gao, Liming" , "Bi, Dandan" Thread-Topic: [edk2] [patch] MdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText" Thread-Index: AQHSg0U4JU+/YxHayUiP5fCFRjTafKFsb8ug Date: Fri, 17 Feb 2017 01:20:07 +0000 Message-ID: <3C0D5C461C9E904E8F62152F6274C0BB3B896121@shsmsx102.ccr.corp.intel.com> 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: Fri, 17 Feb 2017 01:20:10 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Xiaofeng, Do you have any comments on this patch? This patch is to fix the bug you reported (https://bugzilla.tianocore.org/s= how_bug.cgi?id=3D358). Could you help to verify on your platform? Thank you very much! Regards, Dandan -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Dand= an Bi Sent: Friday, February 10, 2017 10:26 AM To: edk2-devel@lists.01.org Cc: Wang Cloud ; Dong, Eric ; Ga= o, Liming Subject: [edk2] [patch] MdeMoudlePkg/DisplayEngine: Fix incorrect index use= d in array "InputText" When set value to the array "InputText", the index was used incorrectly. And the array "InputText" is not initialized. These will cause some value i= n the array is random, so it will be shown incorrectly sometimes. This patch is to fix this issue. https://bugzilla.tianocore.org/show_bug.cgi?id=3D358 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(-) diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c b/MdeMo= dulePkg/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 availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at http://opens= ource.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_LEF= T/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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel