X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FCommon%2FMisc.py;h=549c8791765ffc0c46f381dbda5ce9d7b7ddb61d;hp=a2c6a6a0fbd842b00fce6a0a57523d7066ae5498;hb=520365decb26e5176ec2bb614f11ddeaa495de54;hpb=67e63e9a7b3620fc5fdd3df61b4477a8cd5bc944 diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index a2c6a6a0fb..549c879176 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1611,6 +1611,12 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''): else: IsValid = (len(FieldList) <= 3) # Value, Size = ParseFieldValue(Value) + if Size: + try: + int(Size,16) if Size.upper().startswith("0X") else int(Size) + except: + IsValid = False + Size = -1 return [str(Value), '', str(Size)], IsValid, 0 elif PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT): Value = FieldList[0] @@ -1633,7 +1639,14 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''): IsValid = (len(FieldList) <= 1) else: IsValid = (len(FieldList) <= 3) - return [Value, Type, Size], IsValid, 0 + + if Size: + try: + int(Size,16) if Size.upper().startswith("0X") else int(Size) + except: + IsValid = False + Size = -1 + return [Value, Type, str(Size)], IsValid, 0 elif PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD): VpdOffset = FieldList[0] Value = Size = '' @@ -1649,8 +1662,13 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''): IsValid = (len(FieldList) <= 1) else: IsValid = (len(FieldList) <= 3) - - return [VpdOffset, Size, Value], IsValid, 2 + if Size: + try: + int(Size,16) if Size.upper().startswith("0X") else int(Size) + except: + IsValid = False + Size = -1 + return [VpdOffset, str(Size), Value], IsValid, 2 elif PcdType in (MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII): HiiString = FieldList[0] Guid = Offset = Value = Attribute = ''