Revision: 18267
          http://sourceforge.net/p/edk2/code/18267
Author:   lgao4
Date:     2015-08-24 05:00:05 +0000 (Mon, 24 Aug 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Star Zeng <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/Python/AutoGen/GenC.py

Modified: trunk/edk2/BaseTools/Source/Python/AutoGen/GenC.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/AutoGen/GenC.py  2015-08-24 04:59:38 UTC 
(rev 18266)
+++ trunk/edk2/BaseTools/Source/Python/AutoGen/GenC.py  2015-08-24 05:00:05 UTC 
(rev 18267)
@@ -717,6 +717,7 @@
                 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:


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to