From 5c7956a2a3324ef47e95f3a350e901b2ddfef69c Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Thu, 8 Jan 2015 08:36:05 +0000 Subject: Fixed VfrCompile crash on efivarstore statement. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong Reviewed-by: Aaron Pop git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16591 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/C/VfrCompile/VfrSyntax.g | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'BaseTools/Source/C/VfrCompile') diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g index 1a5b3fd588..2255d6f60b 100644 --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g @@ -917,10 +917,11 @@ vfrStatementVarStoreEfi : CHAR8 *TypeName; UINT32 LineNum; CHAR8 *StoreName = NULL; + BOOLEAN CustomizedName = FALSE; >> E:Efivarstore << VSEObj.SetLineNo(E->getLine()); >> ( - TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >> + TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); CustomizedName = TRUE; >> | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >> | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >> | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >> @@ -953,6 +954,10 @@ vfrStatementVarStoreEfi : if (StoreName == NULL) { _PCATCH (VFR_RETURN_UNSUPPORTED, VN->getLine(), "Can't get varstore name for this StringId!"); } + if (!CustomizedName) { + _PCATCH (VFR_RETURN_UNSUPPORTED, E->getLine(), "Old style efivarstore must have String Identifier!"); + return; + } Size = _STOU32(N->getText(), N->getLine()); switch (Size) { case 1: -- cgit v1.2.3