From e2180ee88cdf1bfdd33e784f9719e573fa6c1f91 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Thu, 22 Mar 2007 10:36:04 +0000 Subject: [PATCH] Add return EFI_INVALID_PARAMETER if pointer type parameter for UEFI and Tiano Decompress protocol function is NULL. The check is necessary. The protocols is built based on library instance of the Decompress Library. The Library class in MDE library spec 0.60e only define to do ASSERT for NULL pointer input. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2501 6f19259b-4bc3-4df7-8a09-765794883524 --- EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c | 39 +++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c b/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c index fce61bd45e..427e6b8ca5 100644 --- a/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -848,6 +848,11 @@ DxeMainUefiDecompressGetInfo ( OUT UINT32 *ScratchSize ) { + if (Source == NULL + || DestinationSize == NULL + || ScratchSize == NULL) { + return EFI_INVALID_PARAMETER; + } return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize); } @@ -866,7 +871,13 @@ DxeMainUefiDecompress ( EFI_STATUS Status; UINT32 TestDestinationSize; UINT32 TestScratchSize; - + + if (Source == NULL + || Destination== NULL + || Scratch == NULL) { + return EFI_INVALID_PARAMETER; + } + Status = UefiDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize); if (EFI_ERROR (Status)) { return Status; @@ -888,6 +899,12 @@ DxeMainTianoDecompressGetInfo ( OUT UINT32 *ScratchSize ) { + if (Source == NULL + || DestinationSize == NULL + || ScratchSize == NULL) { + return EFI_INVALID_PARAMETER; + } + return TianoDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize); } @@ -906,7 +923,13 @@ DxeMainTianoDecompress ( EFI_STATUS Status; UINT32 TestDestinationSize; UINT32 TestScratchSize; - + + if (Source == NULL + || Destination== NULL + || Scratch == NULL) { + return EFI_INVALID_PARAMETER; + } + Status = TianoDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize); if (EFI_ERROR (Status)) { return Status; @@ -928,6 +951,12 @@ DxeMainCustomDecompressGetInfo ( OUT UINT32 *ScratchSize ) { + if (Source == NULL + || DestinationSize == NULL + || ScratchSize == NULL) { + return EFI_INVALID_PARAMETER; + } + return CustomDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize); } @@ -947,6 +976,12 @@ DxeMainCustomDecompress ( UINT32 TestDestinationSize; UINT32 TestScratchSize; + if (Source == NULL + || Destination== NULL + || Scratch == NULL) { + return EFI_INVALID_PARAMETER; + } + Status = CustomDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize); if (EFI_ERROR (Status)) { return Status; -- 2.39.2