riched20 patch

Clinton Stimpson clinton at elemtech.com
Mon Jun 12 23:12:03 CDT 2006


Second attempt (seems my last one email with this patch dropped through 
the cracks ??):

Attached is a patch to fix a crash when EM_SETTEXTEX is called with a 
NULL lParam.
Return values and behavior has been verified and found equivalent to an 
app on Windows.

Thanks,
Clint

------------------------------------------------------------------------

Index: caret.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/caret.c,v
retrieving revision 1.27
diff -u -r1.27 caret.c
--- caret.c	23 May 2006 12:48:31 -0000	1.27
+++ caret.c	7 Jun 2006 01:16:34 -0000
@@ -382,8 +382,10 @@
     ME_DeleteSelection(editor);
 
   assert(nCursor>=0 && nCursor<editor->nCursors);
-  if (len == -1)
+  if (len == -1 && str)
     len = lstrlenW(str);
+  else if(len == -1)
+    len = 0;
   while (len)
   {
     pos = str;
Index: editor.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/editor.c,v
retrieving revision 1.108
diff -u -r1.108 editor.c
--- editor.c	23 May 2006 12:48:31 -0000	1.108
+++ editor.c	7 Jun 2006 01:16:34 -0000
@@ -1591,7 +1591,9 @@
   {
     LPWSTR wszText = (LPWSTR)lParam;
     SETTEXTEX *pStruct = (SETTEXTEX *)wParam;
-    size_t len = lstrlenW(wszText);
+    size_t len = 0;
+    if(wszText) 
+      len = lstrlenW(wszText);
     int from, to;
     ME_Style *style;
     TRACE("EM_SETTEXEX - %s, flags %d, cp %d\n", debugstr_w(wszText), (int)pStruct->flags, pStruct->codepage);




More information about the wine-patches mailing list