summaryrefslogtreecommitdiffstats
path: root/IntelFrameworkModulePkg
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2012-03-29 03:38:08 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2012-03-29 03:38:08 +0000
commit36cef654a56c0211ac429fd4086f08ac1a1ecdad (patch)
tree3852ce86022f0cd68761ee68fe51d816ed852e0b /IntelFrameworkModulePkg
parent7fe5db9a4fb824fe2a7aae174d70e3eab343b6f1 (diff)
downloadedk2-36cef654a56c0211ac429fd4086f08ac1a1ecdad.tar.gz
Sync patch r13094 and r13096 from mail trunk.
Enhance the error handling. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010.SR1@13149 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg')
-rw-r--r--IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c b/IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c
index d586de2556..9300f4dfe0 100644
--- a/IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c
+++ b/IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c
@@ -27,7 +27,7 @@
3) A support protocol is not found, and the data is not available to be read
without it. This results in EFI_PROTOCOL_ERROR.
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -667,8 +667,8 @@ CreateGuidedExtractionRpnEvent (
EFI_STATUS
CreateChildNode (
IN FRAMEWORK_SECTION_STREAM_NODE *Stream,
- IN UINT32 ChildOffset,
- OUT FRAMEWORK_SECTION_CHILD_NODE **ChildNode
+ IN UINT32 ChildOffset,
+ OUT FRAMEWORK_SECTION_CHILD_NODE **ChildNode
)
{
EFI_STATUS Status;
@@ -723,8 +723,11 @@ CreateChildNode (
//
// Get the CompressionSectionHeader
//
- ASSERT (Node->Size >= sizeof (EFI_COMPRESSION_SECTION));
-
+ if (Node->Size < sizeof (EFI_COMPRESSION_SECTION)) {
+ FreePool (Node);
+ return EFI_NOT_FOUND;
+ }
+
CompressionHeader = (EFI_COMPRESSION_SECTION *) SectionHeader;
if (IS_SECTION2 (CompressionHeader)) {
@@ -774,8 +777,14 @@ CreateChildNode (
(UINT32 *)&NewStreamBufferSize,
&ScratchSize
);
- ASSERT_EFI_ERROR (Status);
- ASSERT (NewStreamBufferSize == UncompressedLength);
+ if (EFI_ERROR (Status) || (NewStreamBufferSize != UncompressedLength)) {
+ FreePool (Node);
+ FreePool (NewStreamBuffer);
+ if (!EFI_ERROR (Status)) {
+ Status = EFI_BAD_BUFFER_SIZE;
+ }
+ return Status;
+ }
ScratchBuffer = AllocatePool (ScratchSize);
if (ScratchBuffer == NULL) {
@@ -793,8 +802,12 @@ CreateChildNode (
ScratchBuffer,
ScratchSize
);
- ASSERT_EFI_ERROR (Status);
- FreePool (ScratchBuffer);
+ FreePool (ScratchBuffer);
+ if (EFI_ERROR (Status)) {
+ FreePool (Node);
+ FreePool (NewStreamBuffer);
+ return Status;
+ }
}
} else {
NewStreamBuffer = NULL;