diff options
author | Eric Dong <eric.dong@intel.com> | 2014-04-18 03:17:54 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-04-18 03:17:54 +0000 |
commit | 7e2f32894bb31ba19c89e3561f97068761f5b5c0 (patch) | |
tree | 9c276d3fd2529d8629bd2a7841f0d019cc0fe35f /MdeModulePkg | |
parent | 147113644f043b1b9bd88da4e2b4e79150c78084 (diff) | |
download | edk2-platforms-7e2f32894bb31ba19c89e3561f97068761f5b5c0.tar.xz |
Enhance the browser parse opcode logic, skip the opcode which is not defined in UEFI spec.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Gao, Liming <liming,gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15475 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c | 46 |
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
//
|