mirror of https://github.com/acidanthera/audk.git
Use ReadUnaligned32() instead of CopyMem()
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5604 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
520c936919
commit
7fd58cbc7e
|
@ -16,6 +16,7 @@
|
|||
#include <Base.h>
|
||||
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/UefiDecompressLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
|
@ -689,19 +690,18 @@ UefiDecompressGetInfo (
|
|||
ASSERT (DestinationSize != NULL);
|
||||
ASSERT (ScratchSize != NULL);
|
||||
|
||||
*ScratchSize = sizeof (SCRATCH_DATA);
|
||||
|
||||
if (SourceSize < 8) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
CopyMem (&CompressedSize, Source, sizeof (UINT32));
|
||||
CopyMem (DestinationSize, (VOID *)((UINT8 *)Source + 4), sizeof (UINT32));
|
||||
|
||||
CompressedSize = ReadUnaligned32 ((UINT32 *)Source);
|
||||
if (SourceSize < (CompressedSize + 8)) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*ScratchSize = sizeof (SCRATCH_DATA);
|
||||
*DestinationSize = ReadUnaligned32 ((UINT32 *)Source + 1);
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
|
||||
|
|
Loading…
Reference in New Issue