RICHED20: EM_GETCHARFORMAT fixes.

Felix Nawothnig felix.nawothnig at t-online.de
Sun Jul 10 12:53:25 CDT 2005


TinyIRC sets cbSize to 8 which caused an assert() to fail... testing on 
Windows shows that it should cause failure returning zero (TinyIRC 
connects now).

ChangeLog:
Check structure size and fix return values in EM_GETCHARFORMAT
-------------- next part --------------
Index: editor.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/editor.c,v
retrieving revision 1.39
diff -u -r1.39 editor.c
--- editor.c	6 Jul 2005 11:12:10 -0000	1.39
+++ editor.c	10 Jul 2005 17:46:52 -0000
@@ -1076,14 +1076,19 @@
   }
   case EM_GETCHARFORMAT:
   {
-    CHARFORMAT2W tmp;
+    CHARFORMAT2W tmp, *dst = (CHARFORMAT2W *)lParam;
+    if (dst->cbSize != sizeof(CHARFORMATA) &&
+        dst->cbSize != sizeof(CHARFORMATW) &&
+        dst->cbSize != sizeof(CHARFORMAT2A) &&
+        dst->cbSize != sizeof(CHARFORMAT2W))
+      return 0;
     tmp.cbSize = sizeof(tmp);
     if (!wParam)
       ME_GetDefaultCharFormat(editor, &tmp);
     else
       ME_GetSelectionCharFormat(editor, &tmp);
-    ME_CopyToCFAny((CHARFORMAT2W *)lParam, &tmp);
-    return 0;
+    ME_CopyToCFAny(dst, &tmp);
+    return tmp.dwMask;
   }
   case EM_SETPARAFORMAT:
     ME_SetSelectionParaFormat(editor, (PARAFORMAT2 *)lParam);


More information about the wine-patches mailing list