diff options
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c')
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c index 98754ec544..faff074209 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c @@ -556,7 +556,7 @@ ParseOpCodes ( //
// If scope bit set, push onto scope stack
//
- if (Scope) {
+ if (Scope != 0) {
PushScope (Operand);
}
@@ -717,15 +717,17 @@ ParseOpCodes ( //
case EFI_IFR_SUBTITLE_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_SUBTITLE *) OpCodeData)->Flags;
- if (Scope) {
+ if (Scope != 0) {
mInScopeSubtitle = TRUE;
}
break;
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;
@@ -735,6 +737,7 @@ ParseOpCodes ( //
case EFI_IFR_ACTION_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
if (OpCodeLength == sizeof (EFI_IFR_ACTION_1)) {
//
@@ -748,11 +751,13 @@ ParseOpCodes ( case EFI_IFR_RESET_BUTTON_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
CopyMem (&CurrentStatement->DefaultId, &((EFI_IFR_RESET_BUTTON *) OpCodeData)->DefaultId, sizeof (EFI_DEFAULT_ID));
break;
case EFI_IFR_REF_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
CopyMem (&CurrentStatement->RefFormId, &((EFI_IFR_REF *) OpCodeData)->FormId, sizeof (EFI_FORM_ID));
if (OpCodeLength >= sizeof (EFI_IFR_REF2)) {
@@ -771,6 +776,7 @@ ParseOpCodes ( case EFI_IFR_ONE_OF_OP:
case EFI_IFR_NUMERIC_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_ONE_OF *) OpCodeData)->Flags;
Value = &CurrentStatement->HiiValue;
@@ -820,6 +826,7 @@ ParseOpCodes ( case EFI_IFR_ORDERED_LIST_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->Flags;
CurrentStatement->MaxContainers = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->MaxContainers;
@@ -837,6 +844,7 @@ ParseOpCodes ( case EFI_IFR_CHECKBOX_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_CHECKBOX *) OpCodeData)->Flags;
CurrentStatement->StorageWidth = sizeof (BOOLEAN);
@@ -846,6 +854,7 @@ ParseOpCodes ( case EFI_IFR_STRING_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
//
// MinSize is the minimum number of characters that can be accepted for this opcode,
@@ -864,6 +873,7 @@ ParseOpCodes ( case EFI_IFR_PASSWORD_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
//
// MinSize is the minimum number of characters that can be accepted for this opcode,
@@ -881,6 +891,7 @@ ParseOpCodes ( case EFI_IFR_DATE_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_DATE *) OpCodeData)->Flags;
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_DATE;
@@ -889,6 +900,7 @@ ParseOpCodes ( case EFI_IFR_TIME_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
+ ASSERT (CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_TIME *) OpCodeData)->Flags;
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_TIME;
@@ -999,10 +1011,17 @@ 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;
}
-
+
+ ASSERT (ImageId != NULL);
CopyMem (ImageId, &((EFI_IFR_IMAGE *) OpCodeData)->Id, sizeof (EFI_IMAGE_ID));
break;
@@ -1010,6 +1029,7 @@ ParseOpCodes ( // Refresh
//
case EFI_IFR_REFRESH_OP:
+ ASSERT (CurrentStatement != NULL);
CurrentStatement->RefreshInterval = ((EFI_IFR_REFRESH *) OpCodeData)->RefreshInterval;
break;
|