From 719564ba74e8d605dd2601251d2c251d86153061 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Tue, 24 Mar 2026 16:04:53 +0100 Subject: [PATCH] Fix memory corruption caused by UEFI memory map size changes during allocation --- boot/xtldr/modules/xtos_o/xtos.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/xtldr/modules/xtos_o/xtos.cc b/boot/xtldr/modules/xtos_o/xtos.cc index 563e0ff..bc801a5 100644 --- a/boot/xtldr/modules/xtos_o/xtos.cc +++ b/boot/xtldr/modules/xtos_o/xtos.cc @@ -410,7 +410,7 @@ Xtos::InitializeLoaderBlock(IN PXTBL_PAGE_MAPPING PageMap, FbPages = EFI_SIZE_TO_PAGES(FbSize); /* Calculate number of pages needed for memory descriptor list */ - DescriptorPages = EFI_SIZE_TO_PAGES(PageMap->MapSize * sizeof(LOADER_MEMORY_DESCRIPTOR)); + DescriptorPages = EFI_SIZE_TO_PAGES(PageMap->MapSize * sizeof(LOADER_MEMORY_DESCRIPTOR) * 2); /* Allocate memory for the kernel initialization block and boot parameters */ Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, BlockPages, &PhysicalBlock);