diff options
author | Liming Gao <liming.gao@intel.com> | 2015-08-24 05:00:05 +0000 |
---|---|---|
committer | lgao4 <lgao4@Edk2> | 2015-08-24 05:00:05 +0000 |
commit | 9023704f95e4c3b4fc98a94c3b56936bad5ced0c (patch) | |
tree | 804e37e93a3d80d05d645e533ad198d9c562fa60 /BaseTools/Source | |
parent | c0f230ca75b8528f4d20a397b52a02e912b1bcfa (diff) | |
download | edk2-platforms-9023704f95e4c3b4fc98a94c3b56936bad5ced0c.tar.xz |
BaseTools: Add NULL pointer check in AutoGen code
For DynamicEx PCD, if NULL pointer is specified as token space GUID,
it will directly be used to compare GUID value in AutoGen code.
To avoid access NULL pointer, NULL pointer will be checked first.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18267 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/GenC.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index 84bd607ea6..3afded6f65 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -717,6 +717,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH): Index = Index + 1
if Index == 1:
AutoGenH.Append('\n#define __PCD_%s_VAL_CMP(GuidPtr) (' % (Pcd.TokenCName))
+ AutoGenH.Append('\\\n (GuidPtr == NULL) ? 0:')
AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'
% (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
else:
|