Thomas Faber : usp10: Do not write to last script item if buffer space is insufficient.

Alexandre Julliard julliard at winehq.org
Thu May 1 14:39:59 CDT 2014


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

Author: Thomas Faber <thomas.faber at reactos.org>
Date:   Thu May  1 08:57:09 2014 +0200

usp10: Do not write to last script item if buffer space is insufficient.

---

 dlls/usp10/usp10.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 94785b2..ae164d2 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -1616,12 +1616,12 @@ static HRESULT _ItemizeInternal(const WCHAR *pwcInChars, int cInChars,
      * item is set up to prevent random behaviour if the caller erroneously
      * checks the n+1 structure                                              */
     index++;
+    if (index + 1 > cMaxItems) return E_OUTOFMEMORY;
     memset(&pItems[index].a, 0, sizeof(SCRIPT_ANALYSIS));
 
     TRACE("index=%d cnt=%d iCharPos=%d\n", index, cnt, pItems[index].iCharPos);
 
     /*  Set one SCRIPT_STATE item being returned  */
-    if  (index + 1 > cMaxItems) return E_OUTOFMEMORY;
     if (pcItems) *pcItems = index;
 
     /*  Set SCRIPT_ITEM                                     */




More information about the wine-cvs mailing list