]> git.proxmox.com Git - mirror_edk2.git/commitdiff
K8: Add in ASSERT to detect possible NULL pointer dereference.
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 6 Feb 2009 06:34:43 +0000 (06:34 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 6 Feb 2009 06:34:43 +0000 (06:34 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7462 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c

index 60992a31dd122499211b75a0a9a4e76b3f8cc68e..0070502f9b592b52276c341a71a43b4b2b4154d2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Parser for IFR binary encoding.\r
 \r
-Copyright (c) 2007 - 2008, Intel Corporation\r
+Copyright (c) 2007 - 2009, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -852,6 +852,7 @@ ParseOpCodes (
   CurrentDefault           = NULL;\r
   CurrentOption            = NULL;\r
   OptionSuppressExpression = NULL;\r
+  ImageId                  = NULL;\r
 \r
   //\r
   // Get the number of Statements and Expressions\r
@@ -1063,6 +1064,8 @@ ParseOpCodes (
           if (EFI_ERROR (Status)) {\r
             return Status;\r
           }\r
+\r
+          ASSERT (CurrentExpression != NULL);\r
           if (CurrentExpression->Result.Type != EFI_IFR_TYPE_BOOLEAN) {\r
             return EFI_INVALID_PARAMETER;\r
           }\r
@@ -1604,6 +1607,7 @@ ParseOpCodes (
         break;\r
       }\r
 \r
+      ASSERT (ImageId != NULL);\r
       CopyMem (ImageId, &((EFI_IFR_IMAGE *) OpCodeData)->Id, sizeof (EFI_IMAGE_ID));\r
       break;\r
 \r
@@ -1611,6 +1615,7 @@ ParseOpCodes (
     // Refresh\r
     //\r
     case EFI_IFR_REFRESH_OP:\r
+      ASSERT (CurrentStatement != NULL);\r
       CurrentStatement->RefreshInterval = ((EFI_IFR_REFRESH *) OpCodeData)->RefreshInterval;\r
       break;\r
 \r