[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-patches
Subject:    [PATCH] dbghelp: Crash fix in module_find_cb on trying to parse non image files.
From:       Ralf Habacker <ralf () habacker ! de>
Date:       2015-11-09 13:53:08
Message-ID: 5640A544.2030501 () habacker ! de
[Download RAW message or body]

Bug: https://bugs.winehq.org/show_bug.cgi?id=39568
---
 dlls/dbghelp/path.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c
index a0e51bd..8c74426 100644
--- a/dlls/dbghelp/path.c
+++ b/dlls/dbghelp/path.c
@@ -490,7 +490,13 @@ static BOOL CALLBACK module_find_cb(PCWSTR buffer,
PVOID user)
                 if ((mapping = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0,
0)) != NULL)
                 {
                     IMAGE_NT_HEADERS*   nth = RtlImageNtHeader(mapping);
-
+                    if (!nth)
+                    {
+                        UnmapViewOfFile(mapping);
+                        CloseHandle(hMap);
+                        CloseHandle(hFile);
+                        return FALSE;
+                    }
                     matched++;
                     timestamp = nth->FileHeader.TimeDateStamp;
                     size = nth->OptionalHeader.SizeOfImage;
-- 
1.8.4.5



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic