From: Damjan Jovanovic <damjan.jov@gmail.com>
Subject: comdlg32: fix a stack overflow
Message-Id: <AANLkTikSN2tvXAjA3E2TZu4a=_=TRnUjv7ygXc8Ki4NJ@mail.gmail.com>
Date: Fri, 8 Oct 2010 07:21:23 +0200

Changelog:
* fix a stack overflow

Fails to recurse if a PIDL's parent is itself, stopping a stack
overflow in the Notepad file dialog when the current directory is
outside Wine's drive mappings.

Closes #24556.

Damjan Jovanovic

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index a6f6023..01b068e 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -3349,6 +3349,9 @@ static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd,LPITEMIDLIST pidl)
 
   TRACE("\n");
 
+  if (pidl == pidlParent)
+    return -1;
+
   iParentPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)pidlParent,SEARCH_PIDL);
 
   if(iParentPos < 0)