diff options
author | ajfish <ajfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-26 23:34:08 +0000 |
---|---|---|
committer | ajfish <ajfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-26 23:34:08 +0000 |
commit | 236877a6a7a89512ee67d8bc168dd4c16b85e8db (patch) | |
tree | 5d009a86437656555df2d5cde85de7456276737f /MdePkg/Library/BasePeCoffLib | |
parent | 747e1504f1fd1be7960fd7b39edfed2e838ae0d6 (diff) | |
download | edk2-236877a6a7a89512ee67d8bc168dd4c16b85e8db.tar.gz edk2-236877a6a7a89512ee67d8bc168dd4c16b85e8db.tar.bz2 edk2-236877a6a7a89512ee67d8bc168dd4c16b85e8db.zip |
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
Diffstat (limited to 'MdePkg/Library/BasePeCoffLib')
-rw-r--r-- | MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c index 1e8f573009..6d36b6dff0 100644 --- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c @@ -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);
}
|