From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Eric Dong <eric.dong@intel.com>,
Liming Gao <liming.gao@intel.com>,
Wang Cloud <winggundum82@163.com>
Subject: [patch] MdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText"
Date: Fri, 10 Feb 2017 10:25:30 +0800 [thread overview]
Message-ID: <1486693530-222908-1-git-send-email-dandan.bi@intel.com> (raw)
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=358
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Wang Cloud <winggundum82@163.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
.../Universal/DisplayEngineDxe/InputHandler.c | 33 ++++++++++++----------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c b/MdeModulePkg/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.
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
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
@@ -522,10 +522,11 @@ GetNumericInput (
Negative = FALSE;
ValidateFail = FALSE;
Question = MenuOption->ThisTag;
QuestionValue = &Question->CurrentValue;
+ ZeroMem (InputText, MAX_NUMERIC_INPUT_WIDTH * sizeof (CHAR16));
//
// Only two case, user can enter to this function: Enter and +/- case.
// In Enter case, gDirection = 0; in +/- case, gDirection = SCAN_LEFT/SCAN_WRIGHT
//
@@ -688,20 +689,21 @@ GetNumericInput (
}
if (MenuOption->Sequence == 0) {
InputText[0] = LEFT_NUMERIC_DELIMITER;
SetUnicodeMem (InputText + 1, InputWidth, L' ');
- } else {
+ InputText[InputWidth + 1] = DATE_SEPARATOR;
+ InputText[InputWidth + 2] = L'\0';
+ } else if (MenuOption->Sequence == 1){
SetUnicodeMem (InputText, InputWidth, L' ');
- }
-
- if (MenuOption->Sequence == 2) {
- InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth] = DATE_SEPARATOR;
+ InputText[InputWidth + 1] = L'\0';
} else {
- InputText[InputWidth + 1] = DATE_SEPARATOR;
+ SetUnicodeMem (InputText, InputWidth, L' ');
+ InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth + 1] = L'\0';
}
- InputText[InputWidth + 2] = L'\0';
PrintStringAt (Column, Row, InputText);
if (MenuOption->Sequence == 0) {
Column++;
}
@@ -711,20 +713,21 @@ GetNumericInput (
InputWidth = 2;
if (MenuOption->Sequence == 0) {
InputText[0] = LEFT_NUMERIC_DELIMITER;
SetUnicodeMem (InputText + 1, InputWidth, L' ');
- } else {
+ InputText[InputWidth + 1] = TIME_SEPARATOR;
+ InputText[InputWidth + 2] = L'\0';
+ } else if (MenuOption->Sequence == 1){
SetUnicodeMem (InputText, InputWidth, L' ');
- }
-
- if (MenuOption->Sequence == 2) {
- InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth] = TIME_SEPARATOR;
+ InputText[InputWidth + 1] = L'\0';
} else {
- InputText[InputWidth + 1] = TIME_SEPARATOR;
+ SetUnicodeMem (InputText, InputWidth, L' ');
+ InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth + 1] = L'\0';
}
- InputText[InputWidth + 2] = L'\0';
PrintStringAt (Column, Row, InputText);
if (MenuOption->Sequence == 0) {
Column++;
}
--
1.9.5.msysgit.1
next reply other threads:[~2017-02-10 2:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-10 2:25 Dandan Bi [this message]
2017-02-17 1:20 ` [patch] MdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText" Bi, Dandan
2017-02-20 11:11 ` Dong, Eric
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486693530-222908-1-git-send-email-dandan.bi@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox