* [PATCH] BaseTools: Check the max size for string PCD.
@ 2018-10-31 10:35 Zhaozh1x
2018-10-31 16:15 ` Carsey, Jaben
2018-11-02 8:56 ` Feng, Bob C
0 siblings, 2 replies; 3+ messages in thread
From: Zhaozh1x @ 2018-10-31 10:35 UTC (permalink / raw)
To: edk2-devel; +Cc: Zhaozh1x, Liming Gao, Yonghong Zhu, Bob Feng
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] BaseTools: Check the max size for string PCD.
2018-10-31 10:35 [PATCH] BaseTools: Check the max size for string PCD Zhaozh1x
@ 2018-10-31 16:15 ` Carsey, Jaben
2018-11-02 8:56 ` Feng, Bob C
1 sibling, 0 replies; 3+ messages in thread
From: Carsey, Jaben @ 2018-10-31 16:15 UTC (permalink / raw)
To: Zhao, ZhiqiangX, edk2-devel@lists.01.org; +Cc: Gao, Liming
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Zhaozh1x
> Sent: Wednesday, October 31, 2018 3:36 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [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 <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>
> ---
> 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,PcdNvStoreDfBuffe
> r.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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] BaseTools: Check the max size for string PCD.
2018-10-31 10:35 [PATCH] BaseTools: Check the max size for string PCD Zhaozh1x
2018-10-31 16:15 ` Carsey, Jaben
@ 2018-11-02 8:56 ` Feng, Bob C
1 sibling, 0 replies; 3+ messages in thread
From: Feng, Bob C @ 2018-11-02 8:56 UTC (permalink / raw)
To: Zhao, ZhiqiangX, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-----Original Message-----
From: Zhao, ZhiqiangX
Sent: Wednesday, October 31, 2018 6:36 PM
To: edk2-devel@lists.01.org
Cc: Zhao, ZhiqiangX <zhiqiangx.zhao@intel.com>; Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
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 <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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-02 8:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-31 10:35 [PATCH] BaseTools: Check the max size for string PCD Zhaozh1x
2018-10-31 16:15 ` Carsey, Jaben
2018-11-02 8:56 ` Feng, Bob C
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox