Huw Davies : riched20: Fix the struct size check in the para fmt retrieval function.

Alexandre Julliard julliard at winehq.org
Tue Oct 27 16:43:49 CDT 2020


Module: wine
Branch: master
Commit: 9908c5d3c44b80552947096c97146609e98430e9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9908c5d3c44b80552947096c97146609e98430e9

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Oct 27 08:23:30 2020 +0000

riched20: Fix the struct size check in the para fmt retrieval function.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/para.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index e1b848cf8f9..c7a0e271510 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -928,7 +928,8 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
   ME_DisplayItem *para, *para_end;
   PARAFORMAT2 *curFmt;
 
-  if (pFmt->cbSize < sizeof(PARAFORMAT)) {
+  if (pFmt->cbSize < sizeof(PARAFORMAT))
+  {
     pFmt->dwMask = 0;
     return;
   }
@@ -951,13 +952,14 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
     CHECK_FIELD(PFM_RIGHTINDENT, dxRightIndent);
     CHECK_FIELD(PFM_OFFSET, dxOffset);
     CHECK_FIELD(PFM_ALIGNMENT, wAlignment);
-    if (pFmt->dwMask & PFM_TABSTOPS) {
+    if (pFmt->dwMask & PFM_TABSTOPS)
+    {
       if (pFmt->cTabCount != para->member.para.fmt.cTabCount ||
           memcmp(pFmt->rgxTabs, curFmt->rgxTabs, curFmt->cTabCount*sizeof(int)))
         pFmt->dwMask &= ~PFM_TABSTOPS;
     }
 
-    if (pFmt->dwMask >= sizeof(PARAFORMAT2))
+    if (pFmt->cbSize >= sizeof(PARAFORMAT2))
     {
       pFmt->dwMask &= ~((pFmt->wEffects ^ curFmt->wEffects) << 16);
       CHECK_FIELD(PFM_SPACEBEFORE, dySpaceBefore);




More information about the wine-cvs mailing list