A fix for this problem has been committed to the EDK II repository as 
rev:15319.  The relevant part of the commit description follows:

StdLib: Modify the memory allocation routines to not be dependent upon the 
internal structure of the EDK II memory pool.

StdLib/LibC/StdLib/Malloc.c
Create a private data structure, CPOOL_HEAD, which contains housekeeping 
information for StdLib's memory allocation functions.  An instance of this 
structure is prepended to every chunk of allocated memory.  The structure links 
the allocation into a doubly-linked list and keeps track of the size of each 
allocation unit.  This information is then available for use by the realloc 
function.

Daryl McDaniel

"I don't try to describe the future. I try to prevent it"
-- Ray Bradbury

-----Original Message-----
From: bin_601 [mailto:[email protected]] 
Sent: Monday, February 03, 2014 11:21 PM
To: edk2-devel
Subject: [edk2] Bug in realloc() function of StdLib

Dear all, 

  After EDK2 rev:14820
  MdeModulePkg Pool: Update the type of Size to UINTN for the potential more 
than 4GB buffer allocation.

  It modify the POOL_HEAD structure in MdeModulePkg\Core\Dxe\Mem\Pool.c,
  however it doesn't sync to the POOL_HEAD structure in 
StdLib\LibC\StdLib\Malloc.c.

Original:
typedef struct {
  UINT32          Signature;
  UINT32          Size;
  EFI_MEMORY_TYPE Type;
  UINTN           Reserved;
  CHAR8           Data[1];
} POOL_HEAD;


Modified:
typedef struct {
  UINT32          Signature;
  UINT32          Reserved;
  ^^^^^^^^^^^^^^^^^^^^^^^^
  EFI_MEMORY_TYPE Type;
  UINTN           Size;
  ^^^^^^^^^^^^^^^^^^^^
  CHAR8           Data[1];
} POOL_HEAD;


Thanks,
Bin Lain

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications Take advantage of what the 
Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to