Aric Stewart : usp10: Do not crash in ScriptPlace if pABC is null.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 25 07:06:29 CDT 2007


Module: wine
Branch: master
Commit: 73bec11865270731f9d896fd5f1fda2d2e2c16b7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=73bec11865270731f9d896fd5f1fda2d2e2c16b7

Author: Aric Stewart <aric at codeweavers.com>
Date:   Tue Apr 24 13:03:22 2007 -0500

usp10: Do not crash in ScriptPlace if pABC is null.

---

 dlls/usp10/usp10.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index b2b4b3f..3e1258d 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -1309,8 +1309,8 @@ HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs,
      *   to get the correct ABC widths.   */
 
      if (!(lpABC = usp_zero_alloc(sizeof(ABC) * cGlyphs))) return E_OUTOFMEMORY;
-
-     memset(pABC, 0, sizeof(ABC));
+     if (pABC)
+        memset(pABC, 0, sizeof(ABC));
 
     /* FIXME: set pGoffset to more reasonable values */
      if (!GetCharABCWidthsI(get_cache_hdc(psc), 0, cGlyphs, (WORD *) pwGlyphs, lpABC ))
@@ -1330,15 +1330,19 @@ HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs,
                                   lpABC[wcnt].abcA,
                                   lpABC[wcnt].abcB,
                                   lpABC[wcnt].abcC, wcnt);
-             pABC->abcA += lpABC[wcnt].abcA;
-             pABC->abcB += lpABC[wcnt].abcB;
-             pABC->abcC += lpABC[wcnt].abcC;
+             if (pABC)
+             {
+                pABC->abcA += lpABC[wcnt].abcA;
+                pABC->abcB += lpABC[wcnt].abcB;
+                pABC->abcC += lpABC[wcnt].abcC;
+             }
              piAdvance[wcnt] = lpABC[wcnt].abcA + lpABC[wcnt].abcB + lpABC[wcnt].abcC;
              pGoffset[wcnt].du = 0;
              pGoffset[wcnt].dv = 0;
          }
      }
-     TRACE("Total for run:   abcA=%d,  abcB=%d,  abcC=%d\n", pABC->abcA, pABC->abcB, pABC->abcC);
+     if (pABC)
+        TRACE("Total for run:   abcA=%d,  abcB=%d,  abcC=%d\n", pABC->abcA, pABC->abcB, pABC->abcC);
 
      usp_free(lpABC);
      return S_OK;




More information about the wine-cvs mailing list