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:
Star Zeng 2014-12-17 00:39:51 +00:00 committed by lzeng14
parent 2c23ddaa00
commit fd8a2eb062
1 changed files with 1 additions and 1 deletions

View File

@ -482,7 +482,7 @@ FvCheck (
FfsHeader = (EFI_FFS_FILE_HEADER *) (FvDevice->CachedFv);
}
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) {
CoreFreePool (CacheFfsHeader);