FindClose crash fix.

Rein Klazes rklazes at xs4all.nl
Sat Jun 12 13:34:05 CDT 2004


Hi,

Install of Photoshop 7.0 NL fails when is does this:

FindClose( handle);
/* some odd code */
...
FindClose( handle); /* BUG */
  **Crash**

Sometimes the crash happens inside the FindClose, sometimes shortly
after.

It is obvious why the crash happens, the "handle" is actually a pointer
into the heap and causes havoc when it is used after freed.

Here is a solution that at least fixes the Photoshop install, it is not
perfect but I have no idea how resilient Windows is here.

BTW. I thought Crossover Office supports this application?

Changelog:
	dlls/kernel	: file.c
	Slightly better parameter checking in FindClose() to prevent
	heap corruption when called twice with the same handle.

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/dlls/kernel/file.c	2004-05-22 20:40:35.000000000 +0200
+++ mywine/dlls/kernel/file.c	2004-06-12 20:13:11.000000000 +0200
@@ -1571,7 +1571,8 @@
 {
     FIND_FIRST_INFO *info = (FIND_FIRST_INFO *)handle;
 
-    if (!handle || handle == INVALID_HANDLE_VALUE) goto error;
+    if (!handle || handle == INVALID_HANDLE_VALUE ||
+            !HeapValidate( GetProcessHeap(), 0, info)) goto error;
 
     __TRY
     {


More information about the wine-patches mailing list