Aric Stewart : usp10: Correct an endless loop in Chaining Contextual Substitution if it is a dead rule .

Alexandre Julliard julliard at winehq.org
Tue Jun 14 11:57:50 CDT 2011


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Tue Jun 14 08:36:00 2011 -0500

usp10: Correct an endless loop in Chaining Contextual Substitution if it is a dead rule.

---

 dlls/usp10/shape.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 03d97f4..32833c9 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -1026,20 +1026,24 @@ static INT GSUB_apply_ChainContextSubst(const GSUB_LookupList* lookup, const GSU
 
             ccsf3_4 = (const GSUB_ChainContextSubstFormat3_4 *)(((LPBYTE)ccsf3_3)+sizeof(GSUB_ChainContextSubstFormat3_3) + (sizeof(WORD) * (GET_BE_WORD(ccsf3_3->LookaheadGlyphCount)-1)));
 
-            for (k = 0; k < GET_BE_WORD(ccsf3_4->SubstCount); k++)
+            if (GET_BE_WORD(ccsf3_4->SubstCount))
             {
-                int lookupIndex = GET_BE_WORD(ccsf3_4->SubstLookupRecord[k].LookupListIndex);
-                int SequenceIndex = GET_BE_WORD(ccsf3_4->SubstLookupRecord[k].SequenceIndex) * write_dir;
-
-                TRACE("SUBST: %i -> %i %i\n",k, SequenceIndex, lookupIndex);
-                newIndex = GSUB_apply_lookup(lookup, lookupIndex, glyphs, glyph_index + SequenceIndex, write_dir, glyph_count);
-                if (newIndex == -1)
+                for (k = 0; k < GET_BE_WORD(ccsf3_4->SubstCount); k++)
                 {
-                    ERR("Chain failed to generate a glyph\n");
-                    continue;
+                    int lookupIndex = GET_BE_WORD(ccsf3_4->SubstLookupRecord[k].LookupListIndex);
+                    int SequenceIndex = GET_BE_WORD(ccsf3_4->SubstLookupRecord[k].SequenceIndex) * write_dir;
+
+                    TRACE("SUBST: %i -> %i %i\n",k, SequenceIndex, lookupIndex);
+                    newIndex = GSUB_apply_lookup(lookup, lookupIndex, glyphs, glyph_index + SequenceIndex, write_dir, glyph_count);
+                    if (newIndex == -1)
+                    {
+                        ERR("Chain failed to generate a glyph\n");
+                        continue;
+                    }
                 }
+                return newIndex;
             }
-            return newIndex;
+            else return GSUB_E_NOGLYPH;
         }
     }
     return -1;




More information about the wine-cvs mailing list