https://git.reactos.org/?p=reactos.git;a=commitdiff;h=25d143dd2089e1535ff31d07098a5fd18bde890a

commit 25d143dd2089e1535ff31d07098a5fd18bde890a
Author:     Mark Jansen <[email protected]>
AuthorDate: Wed Sep 12 21:30:49 2018 +0200
Commit:     Mark Jansen <[email protected]>
CommitDate: Wed Sep 12 21:30:49 2018 +0200

    [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 b629213d76..376a780653 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)
     {

Reply via email to