From 831b1045c266f2085fe58fcd9e4eb58ef5cad21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Can=20B=C3=B6l=C3=BCk?= Date: Sun, 6 May 2018 04:02:19 +0300 Subject: [PATCH] Even more sanity checks. --- SimpleMapper.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SimpleMapper.h b/SimpleMapper.h index 90315b3..da61eb8 100644 --- a/SimpleMapper.h +++ b/SimpleMapper.h @@ -90,7 +90,7 @@ static std::vector Mp_CreateImportShell( BYTE* Image, PVOID MappedAdr, boo FileHeader->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ].VirtualAddress ); - while ( ImportDescriptor && ImportDescriptor->Name ) + while ( ImportDescriptor && ImportDescriptor->Name && FileHeader->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ].Size ) { PCHAR ModuleName = ( PCHAR ) Mp_RvaToPointer( Image, ImportDescriptor->Name ); @@ -127,6 +127,8 @@ static std::vector Mp_CreateImportShell( BYTE* Image, PVOID MappedAdr, boo for ( ; Thunk->u1.AddressOfData; Thunk++, Func++ ) { + assert( !( Thunk->u1.Ordinal & IMAGE_ORDINAL_FLAG64 ) ); + FARPROC FunctionAddress = NULL; IMAGE_IMPORT_BY_NAME* ImageImportByName = ( IMAGE_IMPORT_BY_NAME* ) Mp_RvaToPointer( Image, *( DWORD* ) Thunk );