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.z...@intel.com>
Cc: Liming Gao <liming....@intel.com>
Cc: Yonghong Zhu <yonghong....@intel.com>
Cc: Bob Feng <bob.c.f...@intel.com>
---
 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 9c3759c0f5..33f7e6471d 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1397,6 +1397,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.14.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to