mirror of https://github.com/acidanthera/audk.git
BaseTools: Add check for VOID* PCD Max Size
Per spec VOID* PCD max size should be a UINT16 value. so this patch add the value check whether it is in range 0x0 .. 0xFFFF. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
b9130c866d
commit
f843a32877
|
@ -1536,6 +1536,13 @@ class DscBuildData(PlatformBuildClassObject):
|
||||||
if Setting is None:
|
if Setting is None:
|
||||||
continue
|
continue
|
||||||
PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
||||||
|
if MaxDatumSize:
|
||||||
|
if int(MaxDatumSize, 0) > 0xFFFF:
|
||||||
|
EdkLogger.error('build', FORMAT_INVALID, "The size value must not exceed the maximum value of 0xFFFF (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)),
|
||||||
|
File=self.MetaFile, Line=Dummy4)
|
||||||
|
if int(MaxDatumSize, 0) < 0:
|
||||||
|
EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)),
|
||||||
|
File=self.MetaFile, Line=Dummy4)
|
||||||
if (PcdCName, TokenSpaceGuid) in PcdValueDict:
|
if (PcdCName, TokenSpaceGuid) in PcdValueDict:
|
||||||
PcdValueDict[PcdCName, TokenSpaceGuid][SkuName] = (PcdValue, DatumType, MaxDatumSize)
|
PcdValueDict[PcdCName, TokenSpaceGuid][SkuName] = (PcdValue, DatumType, MaxDatumSize)
|
||||||
else:
|
else:
|
||||||
|
@ -2381,6 +2388,13 @@ class DscBuildData(PlatformBuildClassObject):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
||||||
|
if MaxDatumSize:
|
||||||
|
if int(MaxDatumSize, 0) > 0xFFFF:
|
||||||
|
EdkLogger.error('build', FORMAT_INVALID, "The size value must not exceed the maximum value of 0xFFFF (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)),
|
||||||
|
File=self.MetaFile, Line=Dummy4)
|
||||||
|
if int(MaxDatumSize, 0) < 0:
|
||||||
|
EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)),
|
||||||
|
File=self.MetaFile, Line=Dummy4)
|
||||||
SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], '', '', '', '', '', PcdValue)
|
SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], '', '', '', '', '', PcdValue)
|
||||||
if (PcdCName, TokenSpaceGuid) in Pcds:
|
if (PcdCName, TokenSpaceGuid) in Pcds:
|
||||||
pcdObject = Pcds[PcdCName, TokenSpaceGuid]
|
pcdObject = Pcds[PcdCName, TokenSpaceGuid]
|
||||||
|
@ -2714,6 +2728,13 @@ class DscBuildData(PlatformBuildClassObject):
|
||||||
# until the DEC parser has been called.
|
# until the DEC parser has been called.
|
||||||
#
|
#
|
||||||
VpdOffset, MaxDatumSize, InitialValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
VpdOffset, MaxDatumSize, InitialValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
||||||
|
if MaxDatumSize:
|
||||||
|
if int(MaxDatumSize, 0) > 0xFFFF:
|
||||||
|
EdkLogger.error('build', FORMAT_INVALID, "The size value must not exceed the maximum value of 0xFFFF (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)),
|
||||||
|
File=self.MetaFile, Line=Dummy4)
|
||||||
|
if int(MaxDatumSize, 0) < 0:
|
||||||
|
EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)),
|
||||||
|
File=self.MetaFile, Line=Dummy4)
|
||||||
SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], '', '', '', '', VpdOffset, InitialValue)
|
SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], '', '', '', '', VpdOffset, InitialValue)
|
||||||
if (PcdCName, TokenSpaceGuid) in Pcds:
|
if (PcdCName, TokenSpaceGuid) in Pcds:
|
||||||
pcdObject = Pcds[PcdCName, TokenSpaceGuid]
|
pcdObject = Pcds[PcdCName, TokenSpaceGuid]
|
||||||
|
|
Loading…
Reference in New Issue