Commit 9d30a941 authored by Asherah Connor's avatar Asherah Connor Committed by Heinrich Schuchardt
Browse files

efi_loader: don't load beyond VirtualSize

PE section table entries' SizeOfRawData must be a multiple of
FileAlignment, and thus may be rounded up and larger than their

We should not load beyond the VirtualSize, which is "the total size of
the section when loaded into memory" -- we may clobber real data at the
target in some other section, since we load sections in reverse order
and sections are usually laid out sequentially.
Signed-off-by: default avatarAsherah Connor <>
Reviewed-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <>
parent 7c82e12c
......@@ -843,7 +843,7 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle,
memcpy(efi_reloc + sec->VirtualAddress,
efi + sec->PointerToRawData,
min(sec->Misc.VirtualSize, sec->SizeOfRawData));
/* Run through relocations */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment