.../Universal/DisplayEngineDxe/InputHandler.c | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-)
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
Hi Xiaofeng, Do you have any comments on this patch? This patch is to fix the bug you reported (https://bugzilla.tianocore.org/show_bug.cgi?id=358). 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 Dandan Bi Sent: Friday, February 10, 2017 10:26 AM To: edk2-devel@lists.01.org Cc: Wang Cloud <winggundum82@163.com>; Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com> 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.