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 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
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
EFI_STATUS\r
CreateChildNode (\r
IN FRAMEWORK_SECTION_STREAM_NODE *Stream,\r
- IN UINT32 ChildOffset,\r
- OUT FRAMEWORK_SECTION_CHILD_NODE **ChildNode\r
+ IN UINT32 ChildOffset,\r
+ OUT FRAMEWORK_SECTION_CHILD_NODE **ChildNode\r
)\r
{\r
EFI_STATUS Status;\r
//\r
// Get the CompressionSectionHeader\r
//\r
- ASSERT (Node->Size >= sizeof (EFI_COMPRESSION_SECTION));\r
- \r
+ if (Node->Size < sizeof (EFI_COMPRESSION_SECTION)) {\r
+ CoreFreePool (Node);\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
CompressionHeader = (EFI_COMPRESSION_SECTION *) SectionHeader;\r
\r
if (IS_SECTION2 (CompressionHeader)) {\r
(UINT32 *)&NewStreamBufferSize,\r
&ScratchSize\r
);\r
- ASSERT_EFI_ERROR (Status);\r
- ASSERT (NewStreamBufferSize == UncompressedLength);\r
+ if (EFI_ERROR (Status) || (NewStreamBufferSize != UncompressedLength)) {\r
+ CoreFreePool (Node);\r
+ CoreFreePool (NewStreamBuffer);\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = EFI_BAD_BUFFER_SIZE;\r
+ }\r
+ return Status;\r
+ }\r
\r
ScratchBuffer = AllocatePool (ScratchSize);\r
if (ScratchBuffer == NULL) {\r
ScratchBuffer,\r
ScratchSize\r
);\r
- ASSERT_EFI_ERROR (Status);\r
- FreePool (ScratchBuffer); \r
+ FreePool (ScratchBuffer); \r
+ if (EFI_ERROR (Status)) {\r
+ CoreFreePool (Node);\r
+ CoreFreePool (NewStreamBuffer);\r
+ return Status;\r
+ }\r
}\r
} else {\r
NewStreamBuffer = NULL;\r
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 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
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
CreateChildNode (\r
IN CORE_SECTION_STREAM_NODE *Stream,\r
IN UINT32 ChildOffset,\r
- OUT CORE_SECTION_CHILD_NODE **ChildNode\r
+ OUT CORE_SECTION_CHILD_NODE **ChildNode\r
)\r
{\r
EFI_STATUS Status;\r
//\r
// Get the CompressionSectionHeader\r
//\r
- ASSERT (Node->Size >= sizeof (EFI_COMPRESSION_SECTION));\r
+ if (Node->Size < sizeof (EFI_COMPRESSION_SECTION)) {\r
+ CoreFreePool (Node);\r
+ return EFI_NOT_FOUND;\r
+ }\r
\r
CompressionHeader = (EFI_COMPRESSION_SECTION *) SectionHeader;\r
\r
(UINT32 *)&NewStreamBufferSize,\r
&ScratchSize\r
);\r
- ASSERT_EFI_ERROR (Status);\r
- ASSERT (NewStreamBufferSize == UncompressedLength);\r
+ if (EFI_ERROR (Status) || (NewStreamBufferSize != UncompressedLength)) {\r
+ CoreFreePool (Node);\r
+ CoreFreePool (NewStreamBuffer);\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = EFI_BAD_BUFFER_SIZE;\r
+ }\r
+ return Status;\r
+ }\r
\r
ScratchBuffer = AllocatePool (ScratchSize);\r
if (ScratchBuffer == NULL) {\r
ScratchBuffer,\r
ScratchSize\r
);\r
- ASSERT_EFI_ERROR (Status);\r
CoreFreePool (ScratchBuffer);\r
+ if (EFI_ERROR (Status)) {\r
+ CoreFreePool (Node);\r
+ CoreFreePool (NewStreamBuffer);\r
+ return Status;\r
+ }\r
}\r
} else {\r
NewStreamBuffer = NULL;\r