Krzysztof Foltman : riched20: Handle incorrect calls of window procedure.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 3 15:58:22 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 6f15b54ade21c2c1cbf5a64692eb27c6173db706
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=6f15b54ade21c2c1cbf5a64692eb27c6173db706

Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Wed Aug  2 22:54:03 2006 +0200

riched20: Handle incorrect calls of window procedure.

---

 dlls/riched20/editor.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 390ac3b..5b42584 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1060,6 +1060,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD n
         {
           CHARFORMAT2W chf;
           char buf[2048];
+          chf.cbSize = sizeof(chf);
           
           ME_GetSelectionCharFormat(editor, &chf);
           ME_DumpStyleToBuf(&chf, buf);
@@ -1393,11 +1394,16 @@ get_msg_name(UINT msg)
  */
 LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
   SCROLLINFO si;
-  ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongW(hWnd, 0);
+  ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(hWnd, 0);
   
   TRACE("hWnd %p msg %04x (%s) %08x %08lx\n",
         hWnd, msg, get_msg_name(msg), wParam, lParam);
   
+  if (!editor && msg != WM_NCCREATE && msg != WM_NCDESTROY) {
+    ERR("RichEditANSIWndProc called with invalid hWnd %p - application bug?\n", hWnd);
+    return 0; 
+  }
+
   switch(msg) {
   
   UNSUPPORTED_MSG(EM_DISPLAYBAND)




More information about the wine-cvs mailing list