From nobody Sat Apr 27 12:39:03 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486693641744312.6004823985903; Thu, 9 Feb 2017 18:27:21 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9207782071; Thu, 9 Feb 2017 18:27:20 -0800 (PST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 2AAC68204C for ; Thu, 9 Feb 2017 18:27:19 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 09 Feb 2017 18:27:18 -0800 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga002.jf.intel.com with ESMTP; 09 Feb 2017 18:27:17 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,138,1484035200"; d="scan'208";a="42315070" From: Dandan Bi To: edk2-devel@lists.01.org Date: Fri, 10 Feb 2017 10:25:30 +0800 Message-Id: <1486693530-222908-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [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: , Cc: Wang Cloud , Eric Dong , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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. 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 Reviewed-by: Eric Dong --- .../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 available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = 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_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++; } --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel