changeset 98787:22ff4ff011f4

(ftfont_otf_features): Fix indexing gsub_gpos->FeatureList.Feature. Check the validity of indices.
author Kenichi Handa <handa@m17n.org>
date Fri, 17 Oct 2008 02:20:13 +0000
parents 5af028ab0136
children 883a592f544d
files src/ftfont.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ftfont.c	Thu Oct 16 20:06:38 2008 +0000
+++ b/src/ftfont.c	Fri Oct 17 02:20:13 2008 +0000
@@ -1340,7 +1340,7 @@
      OTF_GSUB_GPOS *gsub_gpos;
 {
   Lisp_Object scripts, langsyses, features, sym;
-  int i, j, k;
+  int i, j, k, l;
 
   for (scripts = Qnil, i = gsub_gpos->ScriptList.ScriptCount - 1; i >= 0; i--)
     {
@@ -1359,7 +1359,10 @@
 
 	  for (features = Qnil, k = otf_langsys->FeatureCount - 1; k >= 0; k--)
 	    {
-	      OTF_TAG_SYM (sym, gsub_gpos->FeatureList.Feature[k].FeatureTag);
+	      l = otf_langsys->FeatureIndex[k];
+	      if (l > gsub_gpos->FeatureList.FeatureCount)
+		continue;
+	      OTF_TAG_SYM (sym, gsub_gpos->FeatureList.Feature[l].FeatureTag);
 	      features = Fcons (sym, features);
 	    }
 	  if (j >= 0)