summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/AutoGen.py
diff options
context:
space:
mode:
authorZhao, ZhiqiangX <zhiqiangx.zhao@intel.com>2018-10-31 18:35:47 +0800
committerLiming Gao <liming.gao@intel.com>2018-11-02 22:39:08 +0800
commit93f98985826a6eba30584e9b2ada754b3da17990 (patch)
tree43d209689f1e631a4080fd24f37ec0dde03fde33 /BaseTools/Source/Python/AutoGen/AutoGen.py
parent498cb29dfdcc7232f7b0693e266555c19c43ae20 (diff)
downloadedk2-93f98985826a6eba30584e9b2ada754b3da17990.tar.gz
edk2-93f98985826a6eba30584e9b2ada754b3da17990.tar.bz2
edk2-93f98985826a6eba30584e9b2ada754b3da17990.zip
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 <zhiqiangx.zhao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/AutoGen.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py7
1 files changed, 7 insertions, 0 deletions
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