summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-02 07:18:59 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-02 07:18:59 +0000
commitbc166db3114c8bebb73807d58fbd042c1b79e928 (patch)
tree485bfaa5d3e0afbbebd660c73ef2953e406c2fa8 /MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
parentaf58e377315ae4acb5cd2c960daa26ab2746d9e9 (diff)
downloadedk2-platforms-bc166db3114c8bebb73807d58fbd042c1b79e928.tar.xz
Add in ASSERT to check out-of-bound and possible dereference of NULL pointers.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7391 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index 7a09b32b73..60992a31dd 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -1059,7 +1059,6 @@ ParseOpCodes (
//
// Evaluate DisableIf expression
//
- ASSERT (CurrentExpression != NULL);
Status = EvaluateExpression (FormSet, CurrentForm, CurrentExpression);
if (EFI_ERROR (Status)) {
return Status;
@@ -1193,6 +1192,8 @@ ParseOpCodes (
//
case EFI_IFR_SUBTITLE_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
+
CurrentStatement->Flags = ((EFI_IFR_SUBTITLE *) OpCodeData)->Flags;
if (Scope != 0) {
@@ -1202,6 +1203,7 @@ ParseOpCodes (
case EFI_IFR_TEXT_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
CopyMem (&CurrentStatement->TextTwo, &((EFI_IFR_TEXT *) OpCodeData)->TextTwo, sizeof (EFI_STRING_ID));
break;
@@ -1211,6 +1213,7 @@ ParseOpCodes (
//
case EFI_IFR_ACTION_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
if (OpCodeLength == sizeof (EFI_IFR_ACTION_1)) {
//
@@ -1548,6 +1551,12 @@ ParseOpCodes (
//
// If used for a question, then the question will be read-only
//
+ //
+ // Make sure CurrentStatement is not NULL.
+ // If it is NULL, 1) ParseOpCodes functions may parse the IFR wrongly. Or 2) the IFR
+ // file is wrongly generated by tools such as VFR Compiler. There may be a bug in VFR Compiler.
+ //
+ ASSERT (CurrentStatement != NULL);
CurrentStatement->ValueExpression = CurrentExpression;
}
break;
@@ -1585,6 +1594,12 @@ ParseOpCodes (
break;
default:
+ //
+ // Make sure CurrentStatement is not NULL.
+ // If it is NULL, 1) ParseOpCodes functions may parse the IFR wrongly. Or 2) the IFR
+ // file is wrongly generated by tools such as VFR Compiler.
+ //
+ ASSERT (CurrentStatement != NULL);
ImageId = &CurrentStatement->ImageId;
break;
}