mirror of https://github.com/acidanthera/audk.git
Added back safety check for PE/COFF image walking. I think the safety check is broken in some places (Linux) but we need to investigate more.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1108 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
747e1504f1
commit
236877a6a7
|
@ -488,6 +488,15 @@ PeCoffLoaderImageAddress (
|
|||
IN UINTN Address
|
||||
)
|
||||
{
|
||||
//
|
||||
// @bug Check to make sure ImageSize is correct for the relocated image.
|
||||
// it may only work for the file we start with and not the relocated image
|
||||
//
|
||||
if (Address >= ImageContext->ImageSize) {
|
||||
ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_ADDRESS;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (CHAR8 *)((UINTN) ImageContext->ImageAddress + Address);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue