]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Check the max size for string PCD.
authorZhao, ZhiqiangX <zhiqiangx.zhao@intel.com>
Wed, 31 Oct 2018 10:35:47 +0000 (18:35 +0800)
committerLiming Gao <liming.gao@intel.com>
Fri, 2 Nov 2018 14:39:08 +0000 (22:39 +0800)
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>
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