8ade12
8ade12
# erAck: resolves https://bugzilla.redhat.com/show_bug.cgi?id=1074549
8ade12
# Based on http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/rev/9d29c19f1de1
8ade12
# where a/src/share/native/sun/font/layout/LookupProcessor.cpp is
8ade12
# icu/source/layout/LookupProcessor.cpp
8ade12
# Adapted to LayoutEngine "patch" and subsequent patches.
8ade12
# Note that
8ade12
#@@ -246,7 +249,7 @@
8ade12
#-      featureReferences += SWAPW(featureTable->lookupCount);
8ade12
#+      featureReferences += SWAPW(requiredFeatureTable->lookupCount);
8ade12
# was already applied with icu.8800.freeserif.crash.patch that also added
8ade12
#+      if (requiredFeatureTable.isValid()) {
8ade12
# and is a slightly enhanced version of
8ade12
# https://ssl.icu-project.org/trac/ticket/8800 and/or
8ade12
# https://ssl.icu-project.org/trac/ticket/8320
8ade12
8ade12
--- prev.icu/source/layout/LookupProcessor.cpp	2014-03-11 20:46:53.288819882 +0100
8ade12
+++ icu/source/layout/LookupProcessor.cpp	2014-03-11 20:54:43.153370234 +0100
8ade12
@@ -113,7 +113,7 @@
8ade12
 le_int32 LookupProcessor::selectLookups(const LEReferenceTo<FeatureTable> &featureTable, FeatureMask featureMask, le_int32 order, LEErrorCode &success)
8ade12
 {
8ade12
   le_uint16 lookupCount = featureTable.isValid()? SWAPW(featureTable->lookupCount) : 0;
8ade12
-    le_int32  store = order;
8ade12
+    le_uint32  store = (le_uint32)order;
8ade12
     
8ade12
     LEReferenceToArrayOf<le_uint16> lookupListIndexArray(featureTable, success, featureTable->lookupListIndexArray, lookupCount);
8ade12
 
8ade12
@@ -122,6 +122,9 @@
8ade12
       if (lookupListIndex >= lookupSelectCount) {
8ade12
         continue;
8ade12
       }
8ade12
+      if (store >= lookupOrderCount) {
8ade12
+        continue;
8ade12
+      }
8ade12
       
8ade12
       lookupSelectArray[lookupListIndex] |= featureMask;
8ade12
       lookupOrderArray[store++] = lookupListIndex;