mirror of https://github.com/acidanthera/audk.git
MdeModulePkg DxeCore: Fix potential FV overflow of 4GB boundary on a 32-bit systems.
The traversing of a Memory Mapped FV can overflow the 4GB limit on a 32bit system during the setting up a Linked List of FFS file inside the FV. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16527 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
2c23ddaa00
commit
fd8a2eb062
|
@ -482,7 +482,7 @@ FvCheck (
|
||||||
FfsHeader = (EFI_FFS_FILE_HEADER *) (FvDevice->CachedFv);
|
FfsHeader = (EFI_FFS_FILE_HEADER *) (FvDevice->CachedFv);
|
||||||
}
|
}
|
||||||
TopFvAddress = FvDevice->EndOfCachedFv;
|
TopFvAddress = FvDevice->EndOfCachedFv;
|
||||||
while ((UINT8 *) FfsHeader < TopFvAddress) {
|
while (((UINTN) FfsHeader >= (UINTN) FvDevice->CachedFv) && ((UINTN) FfsHeader <= (UINTN) ((UINTN) TopFvAddress - sizeof (EFI_FFS_FILE_HEADER)))) {
|
||||||
|
|
||||||
if (FileCached) {
|
if (FileCached) {
|
||||||
CoreFreePool (CacheFfsHeader);
|
CoreFreePool (CacheFfsHeader);
|
||||||
|
|
Loading…
Reference in New Issue