]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools: Check the max size for string PCD.
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / AutoGen.py
index a1c8dc7efbb6fce9a142d41537c748dd34ab40cc..f3560bfc787da5fe6ad6e002aadface5e7749e3e 100644 (file)
@@ -1399,6 +1399,13 @@ class PlatformAutoGen(AutoGen):
                 self.VariableInfo = self.CollectVariables(self._DynamicPcdList)\r
                 vardump = self.VariableInfo.dump()\r
                 if vardump:\r
+                    #\r
+                    #According to PCD_DATABASE_INIT in edk2\MdeModulePkg\Include\Guid\PcdDataBaseSignatureGuid.h,\r
+                    #the max size for string PCD should not exceed USHRT_MAX 65535(0xffff).\r
+                    #typedef UINT16 SIZE_INFO;\r
+                    #//SIZE_INFO  SizeTable[];\r
+                    if len(vardump.split(",")) > 0xffff:\r
+                        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(","))))\r
                     PcdNvStoreDfBuffer.DefaultValue = vardump\r
                     for skuname in PcdNvStoreDfBuffer.SkuInfoList:\r
                         PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultValue = vardump\r