[DBGHELP] Prevent crashing on a malformed PE file.
authorMark Jansen <mark.jansen@reactos.org>
Wed, 12 Sep 2018 19:30:49 +0000 (21:30 +0200)
committerMark Jansen <mark.jansen@reactos.org>
Wed, 12 Sep 2018 19:30:49 +0000 (21:30 +0200)
CORE-15030

dll/win32/dbghelp/pe_module.c

index b629213..376a780 100644 (file)
@@ -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)
     {