From 93f98985826a6eba30584e9b2ada754b3da17990 Mon Sep 17 00:00:00 2001 From: "Zhao, ZhiqiangX" Date: Wed, 31 Oct 2018 18:35:47 +0800 Subject: [PATCH] BaseTools: Check the max size for string PCD. According to PCD_DATABASE_INIT in edk2\MdeModulePkg\Include\Guid\PcdDataBaseSignatureGuid.h, the max size for string PCD should not exceed USHRT_MAX 65535(0xffff). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: ZhiqiangX Zhao Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng Reviewed-by: Bob Feng --- BaseTools/Source/Python/AutoGen/AutoGen.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index a1c8dc7efb..f3560bfc78 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1399,6 +1399,13 @@ class PlatformAutoGen(AutoGen): self.VariableInfo = self.CollectVariables(self._DynamicPcdList) vardump = self.VariableInfo.dump() if vardump: + # + #According to PCD_DATABASE_INIT in edk2\MdeModulePkg\Include\Guid\PcdDataBaseSignatureGuid.h, + #the max size for string PCD should not exceed USHRT_MAX 65535(0xffff). + #typedef UINT16 SIZE_INFO; + #//SIZE_INFO SizeTable[]; + if len(vardump.split(",")) > 0xffff: + EdkLogger.error("build", RESOURCE_OVERFLOW, 'The current length of PCD %s value is %d, it exceeds to the max size of String PCD.' %(".".join([PcdNvStoreDfBuffer.TokenSpaceGuidCName,PcdNvStoreDfBuffer.TokenCName]) ,len(vardump.split(",")))) PcdNvStoreDfBuffer.DefaultValue = vardump for skuname in PcdNvStoreDfBuffer.SkuInfoList: PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultValue = vardump -- 2.39.2