From: "Dong, Eric" <eric.dong@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Wang Cloud <winggundum82@163.com>, "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [patch] MdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText"
Date: Mon, 20 Feb 2017 11:11:13 +0000 [thread overview]
Message-ID: <ED077930C258884BBCB450DB737E66224A8F51C7@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1486693530-222908-1-git-send-email-dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Dandan 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 used 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
> 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
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
prev parent reply other threads:[~2017-02-20 11:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-10 2:25 [patch] MdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText" Dandan Bi
2017-02-17 1:20 ` Bi, Dandan
2017-02-20 11:11 ` Dong, Eric [this message]
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=ED077930C258884BBCB450DB737E66224A8F51C7@shsmsx102.ccr.corp.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