summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-20 12:55:02 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-20 12:55:02 +0000
commit40a06b0ca865395b938f9411ab1b9a2c718f1c5b (patch)
tree072c1682191b925d3aa4f836018b7b0195b72963 /MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
parent7bfc66a284e167ef9e63855a2fedee3559933496 (diff)
downloadedk2-platforms-40a06b0ca865395b938f9411ab1b9a2c718f1c5b.tar.xz
K8:
1) Replace immediate constant with MACRO. 2) Add in ASSERT for NULL before dereferencing pointers and after memory allocation. 3) Add a return statement in ProcessOptions to handle the mismatch between the value stored and the opcode for one-of-option in orderedlist opcode. This case occurs when the one-of-optoin entry in OrderedList get deleted. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7320 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
index 90aa311431..d122aec569 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
@@ -235,9 +235,9 @@ GetNumericInput (
EFI_STATUS Status;
UINTN Column;
UINTN Row;
- CHAR16 InputText[23];
- CHAR16 FormattedNumber[22];
- UINT64 PreviousNumber[20];
+ CHAR16 InputText[MAX_NUMERIC_INPUT_WIDTH];
+ CHAR16 FormattedNumber[MAX_NUMERIC_INPUT_WIDTH - 1];
+ UINT64 PreviousNumber[MAX_NUMERIC_INPUT_WIDTH - 3];
UINTN Count;
UINTN Loop;
BOOLEAN ManualInput;
@@ -387,6 +387,7 @@ GetNumericInput (
InputText[0] = LEFT_NUMERIC_DELIMITER;
SetUnicodeMem (InputText + 1, InputWidth, L' ');
+ ASSERT (InputWidth < MAX_NUMERIC_INPUT_WIDTH);
InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
InputText[InputWidth + 2] = L'\0';
@@ -640,6 +641,7 @@ EnterCarriageReturn:
if (EditValue > Maximum) {
UpdateStatusBar (INPUT_ERROR, Question->QuestionFlags, TRUE);
+ ASSERT (Count < sizeof (PreviousNumber) / sizeof (PreviousNumber[0]));
EditValue = PreviousNumber[Count];
break;
} else {
@@ -970,6 +972,7 @@ TheKey:
if (HighlightOptionIndex > 0) {
HighlightOptionIndex--;
+ ASSERT (CurrentOption != NULL);
SwapListEntries (CurrentOption->Link.BackLink, &CurrentOption->Link);
}
}
@@ -997,6 +1000,7 @@ TheKey:
if (HighlightOptionIndex < (PopUpMenuLines - 1)) {
HighlightOptionIndex++;
+ ASSERT (CurrentOption != NULL);
SwapListEntries (&CurrentOption->Link, CurrentOption->Link.ForwardLink);
}
}
@@ -1096,6 +1100,7 @@ TheKey:
Link = GetNextNode (&Question->OptionListHead, Link);
}
} else {
+ ASSERT (CurrentOption != NULL);
CopyMem (&Question->HiiValue, &CurrentOption->Value, sizeof (EFI_HII_VALUE));
}