mirror of https://github.com/acidanthera/audk.git
Add some ASSERT()s to avoid NULL reference.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7162 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
6160c62835
commit
03bd58dc4b
|
@ -588,10 +588,12 @@ PeCoffLoaderRelocateImage (
|
||||||
|
|
||||||
if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
|
if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
|
||||||
RelocBase = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
|
RelocBase = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
|
||||||
|
ASSERT(RelocBase != NULL);
|
||||||
RelocBaseEnd = PeCoffLoaderImageAddress (
|
RelocBaseEnd = PeCoffLoaderImageAddress (
|
||||||
ImageContext,
|
ImageContext,
|
||||||
RelocDir->VirtualAddress + RelocDir->Size - 1
|
RelocDir->VirtualAddress + RelocDir->Size - 1
|
||||||
);
|
);
|
||||||
|
ASSERT(RelocBaseEnd !=NULL);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Set base and end to bypass processing below.
|
// Set base and end to bypass processing below.
|
||||||
|
@ -626,6 +628,7 @@ PeCoffLoaderRelocateImage (
|
||||||
RelocEnd = (UINT16 *) ((CHAR8 *) RelocBase + RelocBase->SizeOfBlock);
|
RelocEnd = (UINT16 *) ((CHAR8 *) RelocBase + RelocBase->SizeOfBlock);
|
||||||
if (!(ImageContext->IsTeImage)) {
|
if (!(ImageContext->IsTeImage)) {
|
||||||
FixupBase = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress);
|
FixupBase = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress);
|
||||||
|
ASSERT(FixupBase != NULL);
|
||||||
} else {
|
} else {
|
||||||
FixupBase = (CHAR8 *)(UINTN)(ImageContext->ImageAddress +
|
FixupBase = (CHAR8 *)(UINTN)(ImageContext->ImageAddress +
|
||||||
RelocBase->VirtualAddress +
|
RelocBase->VirtualAddress +
|
||||||
|
|
Loading…
Reference in New Issue