summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index b4f045df60..920c839956 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -1074,6 +1074,23 @@ IsStatementOpCode (
}
/**
+ Tell whether this Operand is an known OpCode.
+
+ @param Operand Operand of an IFR OpCode.
+
+ @retval TRUE This is an Statement OpCode.
+ @retval FALSE Not an Statement OpCode.
+
+**/
+BOOLEAN
+IsUnKnownOpCode (
+ IN UINT8 Operand
+ )
+{
+ return Operand > EFI_IFR_WARNING_IF_OP ? TRUE : FALSE;
+}
+
+/**
Calculate number of Statemens(Questions) and Expression OpCodes.
@param FormSet The FormSet to be counted.
@@ -1165,6 +1182,8 @@ ParseOpCodes (
EFI_VARSTORE_ID TempVarstoreId;
BOOLEAN InScopeDisable;
INTN ConditionalExprCount;
+ BOOLEAN InUnknownScope;
+ UINT8 UnknownDepth;
SuppressForQuestion = FALSE;
SuppressForOption = FALSE;
@@ -1184,6 +1203,8 @@ ParseOpCodes (
MapExpressionList = NULL;
TempVarstoreId = 0;
ConditionalExprCount = 0;
+ InUnknownScope = FALSE;
+ UnknownDepth = 0;
//
// Get the number of Statements and Expressions
@@ -1226,6 +1247,31 @@ ParseOpCodes (
Operand = ((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode;
Scope = ((EFI_IFR_OP_HEADER *) OpCodeData)->Scope;
+ if (InUnknownScope) {
+ if (Operand == EFI_IFR_END_OP) {
+ UnknownDepth --;
+
+ if (UnknownDepth == 0) {
+ InUnknownScope = FALSE;
+ }
+ } else {
+ if (Scope != 0) {
+ UnknownDepth ++;
+ }
+ }
+
+ continue;
+ }
+
+ if (IsUnKnownOpCode(Operand)) {
+ if (Scope != 0) {
+ InUnknownScope = TRUE;
+ UnknownDepth ++;
+ }
+
+ continue;
+ }
+
//
// If scope bit set, push onto scope stack
//