diff options
author | Feng, YunhuaX <yunhuax.feng@intel.com> | 2018-08-08 14:14:20 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-09-14 13:41:07 +0800 |
commit | 85e5d3cf6b32127977d0d4ef293f4b07daa23747 (patch) | |
tree | a51e63a99088822dead34b65bd8f2f414c2b60f7 /BaseTools/Source/Python/Common/Misc.py | |
parent | f316a26013f2a8cfb1041d9f74a5c6d5bb9df9c9 (diff) | |
download | edk2-85e5d3cf6b32127977d0d4ef293f4b07daa23747.tar.gz edk2-85e5d3cf6b32127977d0d4ef293f4b07daa23747.tar.bz2 edk2-85e5d3cf6b32127977d0d4ef293f4b07daa23747.zip |
BaseTools: Check GUID C structure format
GUID C format must conform to {8,4,4,{2,2,2,2,2,2,2,2}}
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Common/Misc.py')
-rw-r--r-- | BaseTools/Source/Python/Common/Misc.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 430bf6bcda..fc90ccb2c8 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -360,6 +360,8 @@ def GuidStructureByteArrayToGuidString(GuidValue): # @retval string The GUID value in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format
#
def GuidStructureStringToGuidString(GuidValue):
+ if not GlobalData.gGuidCFormatPattern.match(GuidValue):
+ return ''
guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "").replace(";", "")
guidValueList = guidValueString.split(",")
if len(guidValueList) != 11:
@@ -1327,7 +1329,7 @@ def ParseFieldValue (Value): Value = Value.split('(', 1)[1][:-1].strip()
if Value[0] == '{' and Value[-1] == '}':
TmpValue = GuidStructureStringToGuidString(Value)
- if len(TmpValue) == 0:
+ if not TmpValue:
raise BadExpression("Invalid GUID value string %s" % Value)
Value = TmpValue
if Value[0] == '"' and Value[-1] == '"':
|