]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add code check to avoid access violation.
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Feb 2012 02:44:20 +0000 (02:44 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Feb 2012 02:44:20 +0000 (02:44 +0000)
Signed-off-by:ydong10
Reviewed-by:lgao4

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13036 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c

index 05e6a9e796879c959d3daa98812c9a24aa56f7a5..3a12cb1408f68561381ad0ca9aaf463f3c3e2c9e 100644 (file)
@@ -50,6 +50,10 @@ GetExtractGuidedSectionHandlerInfo (
   // Set the available memory address to handler info.\r
   //\r
   HandlerInfo = (EXTRACT_GUIDED_SECTION_HANDLER_INFO*)(VOID*)(UINTN) PcdGet64 (PcdGuidedExtractHandlerTableAddress);\r
+  if (HandlerInfo == NULL) {\r
+    *InfoPointer = NULL;\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
 \r
   //\r
   // First check whether the handler information structure is initialized.\r
@@ -129,6 +133,7 @@ ExtractGuidedSectionGetGuidList (
   //\r
   // Get GuidTable and Table Number\r
   //\r
+  ASSERT (HandlerInfo != NULL);\r
   *ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;\r
   return HandlerInfo->NumberOfExtractHandler;\r
 }\r
@@ -187,6 +192,7 @@ ExtractGuidedSectionRegisterHandlers (
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
+  ASSERT (HandlerInfo != NULL);\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
     if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {\r
       //\r
@@ -288,6 +294,7 @@ ExtractGuidedSectionGetInfo (
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
+  ASSERT (HandlerInfo != NULL);\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
     if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r
@@ -381,6 +388,7 @@ ExtractGuidedSectionDecode (
   //\r
   // Search the match registered Extract handler for the input guided section.\r
   //\r
+  ASSERT (HandlerInfo != NULL);\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
     if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r
index 1fad3d0c478f1e45e0ce43ae7a243ff26226d769..ffb11273bd9287e2d395d4e98a533ca3abf1846a 100644 (file)
@@ -156,6 +156,7 @@ ExtractGuidedSectionGetGuidList (
   //\r
   // Get GuidTable and Table Number\r
   //\r
+  ASSERT (HandlerInfo != NULL);\r
   *ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;\r
   return HandlerInfo->NumberOfExtractHandler;\r
 }\r
@@ -216,6 +217,7 @@ ExtractGuidedSectionRegisterHandlers (
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
+  ASSERT (HandlerInfo != NULL);\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
     if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {\r
       //\r
@@ -317,6 +319,7 @@ ExtractGuidedSectionGetInfo (
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
+  ASSERT (HandlerInfo != NULL);\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
     if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r
@@ -410,6 +413,7 @@ ExtractGuidedSectionDecode (
   //\r
   // Search the match registered Extract handler for the input guided section.\r
   //\r
+  ASSERT (HandlerInfo != NULL);\r
   for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
     if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r