From 25d143dd2089e1535ff31d07098a5fd18bde890a Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Wed, 12 Sep 2018 21:30:49 +0200 Subject: [PATCH] [DBGHELP] Prevent crashing on a malformed PE file. CORE-15030 --- dll/win32/dbghelp/pe_module.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dll/win32/dbghelp/pe_module.c b/dll/win32/dbghelp/pe_module.c index b629213d769..376a780653b 100644 --- a/dll/win32/dbghelp/pe_module.c +++ b/dll/win32/dbghelp/pe_module.c @@ -615,6 +615,15 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod dbg = RtlImageRvaToVa(nth, mapping, dir->VirtualAddress, NULL); +#ifdef __REACTOS__ + if (!dbg) + { + ERR("Debug directory not found in module %s\n", + debugstr_w(module->module.ModuleName)); + goto done; + } +#endif + /* Parse debug directory */ if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED) {