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:
ajfish 2006-07-26 23:34:08 +00:00
parent 747e1504f1
commit 236877a6a7
1 changed files with 9 additions and 0 deletions

View File

@ -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);
}