]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c
UefiLib:
[mirror_edk2.git] / MdePkg / Library / DxeMemoryAllocationLib / MemoryAllocationLib.c
index 088a10bb5623f5f27bb67084f979226909a91c18..15a419bc566af3dc8e6f178e5c4afb1418ee51a9 100644 (file)
@@ -474,6 +474,9 @@ InternalAllocateCopyPool (
 {\r
   VOID  *Memory;\r
 \r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
+\r
   Memory = InternalAllocatePool (PoolType, AllocationSize);\r
   if (Memory != NULL) {\r
      Memory = CopyMem (Memory, Buffer, AllocationSize);\r
@@ -793,6 +796,9 @@ InternalAllocateAlignedCopyPool (
 {\r
   VOID  *Memory;\r
   \r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
+\r
   Memory = InternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);\r
   if (Memory != NULL) {\r
     Memory = CopyMem (Memory, Buffer, AllocationSize);\r