UefiPayloadPkg: Fix LoadDxeCore for payload size > 16MB

Fix calculation of first section in FileFindSection for FILE2 headers
in UefiPayloadEntry module.

Signed-off-by: Sebastian Witt <sebastian.witt@siemens.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
This commit is contained in:
Sebastian Witt 2024-06-03 17:43:22 +02:00 committed by mergify[bot]
parent 3dcc7b73df
commit 6d15276ced
1 changed files with 3 additions and 2 deletions

View File

@ -211,14 +211,15 @@ FileFindSection (
if (IS_FFS_FILE2 (FileHeader)) {
FileSize = FFS_FILE2_SIZE (FileHeader);
Section = (EFI_COMMON_SECTION_HEADER *)(((EFI_FFS_FILE_HEADER2 *)FileHeader) + 1);
} else {
FileSize = FFS_FILE_SIZE (FileHeader);
Section = (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1);
}
FileSize -= sizeof (EFI_FFS_FILE_HEADER);
Section = (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1);
Index = 0;
Index = 0;
while (Index < FileSize) {
if (Section->Type == SectionType) {
if (IS_SECTION2 (Section)) {