]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
Fix a bug that FV->ReadSection cannot get the EFI_SECTION_GUID_DEFINED type section...
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / SectionExtraction / CoreSectionExtraction.c
index d2c40049d26935ed932b5f5f5ec9b09224159474..243b6b27aeccdadb0c4384a2739307330f38f3ea 100644 (file)
@@ -27,7 +27,7 @@
   3) A support protocol is not found, and the data is not available to be read\r
      without it.  This results in EFI_PROTOCOL_ERROR.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2010, Intel Corporation. <BR>\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
@@ -471,7 +471,7 @@ ChildIsType (
   if (Child->Type != SearchType) {\r
     return FALSE;\r
   }\r
-  if (SearchType != EFI_SECTION_GUID_DEFINED) {\r
+  if ((SearchType != EFI_SECTION_GUID_DEFINED) || (SectionDefinitionGuid == NULL)) {\r
     return TRUE;\r
   }\r
   GuidedSection = (EFI_GUID_DEFINED_SECTION * )(Stream->StreamBuffer + Child->OffsetInStream);\r
@@ -580,8 +580,8 @@ CreateChildNode (
           // Decompress the stream\r
           //\r
           Status = CoreLocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **)&Decompress);\r
-\r
           ASSERT_EFI_ERROR (Status);\r
+          ASSERT (Decompress != NULL);\r
 \r
           Status = Decompress->GetInfo (\r
                                  Decompress,\r
@@ -635,7 +635,7 @@ CreateChildNode (
       GuidedHeader = (EFI_GUID_DEFINED_SECTION *) SectionHeader;\r
       Node->EncapsulationGuid = &GuidedHeader->SectionDefinitionGuid;\r
       Status = CoreLocateProtocol (Node->EncapsulationGuid, NULL, (VOID **)&GuidedExtraction);\r
-      if (!EFI_ERROR (Status)) {\r
+      if (!EFI_ERROR (Status) && GuidedExtraction != NULL) {\r
         //\r
         // NewStreamBuffer is always allocated by ExtractSection... No caller\r
         // allocation here.\r
@@ -807,6 +807,7 @@ FindChildNode (
   CurrentChildNode = CHILD_SECTION_NODE_FROM_LINK (GetFirstNode(&SourceStream->Children));\r
 \r
   for (;;) {\r
+    ASSERT (CurrentChildNode != NULL);\r
     if (ChildIsType (SourceStream, CurrentChildNode, SearchType, SectionDefinitionGuid)) {\r
       //\r
       // The type matches, so check the instance count to see if it's the one we want\r