Index: compiler-rt/trunk/lib/interception/interception_win.cc =================================================================== --- compiler-rt/trunk/lib/interception/interception_win.cc +++ compiler-rt/trunk/lib/interception/interception_win.cc @@ -878,6 +878,8 @@ IMAGE_DATA_DIRECTORY *export_directory = &headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT]; + if (export_directory->Size == 0) + return 0; RVAPtr exports(module, export_directory->VirtualAddress); RVAPtr functions(module, exports->AddressOfFunctions); Index: compiler-rt/trunk/lib/interception/tests/interception_win_test.cc =================================================================== --- compiler-rt/trunk/lib/interception/tests/interception_win_test.cc +++ compiler-rt/trunk/lib/interception/tests/interception_win_test.cc @@ -613,6 +613,13 @@ EXPECT_FALSE(TestFunctionPatching(kUnpatchableCode6, override, prefix)); } +TEST(Interception, EmptyExportTable) { + // We try to get a pointer to a function from an executable that doesn't + // export any symbol (empty export table). + uptr FunPtr = InternalGetProcAddress((void *)GetModuleHandleA(0), "example"); + EXPECT_EQ(0U, FunPtr); +} + } // namespace __interception #endif // SANITIZER_WINDOWS