comparison src/ftfont.c @ 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 f2f525a089e1
children 411ea0d5dade
comparison
equal deleted inserted replaced
98786:5af028ab0136 98787:22ff4ff011f4
1338 static Lisp_Object 1338 static Lisp_Object
1339 ftfont_otf_features (gsub_gpos) 1339 ftfont_otf_features (gsub_gpos)
1340 OTF_GSUB_GPOS *gsub_gpos; 1340 OTF_GSUB_GPOS *gsub_gpos;
1341 { 1341 {
1342 Lisp_Object scripts, langsyses, features, sym; 1342 Lisp_Object scripts, langsyses, features, sym;
1343 int i, j, k; 1343 int i, j, k, l;
1344 1344
1345 for (scripts = Qnil, i = gsub_gpos->ScriptList.ScriptCount - 1; i >= 0; i--) 1345 for (scripts = Qnil, i = gsub_gpos->ScriptList.ScriptCount - 1; i >= 0; i--)
1346 { 1346 {
1347 OTF_Script *otf_script = gsub_gpos->ScriptList.Script + i; 1347 OTF_Script *otf_script = gsub_gpos->ScriptList.Script + i;
1348 1348
1357 else 1357 else
1358 break; 1358 break;
1359 1359
1360 for (features = Qnil, k = otf_langsys->FeatureCount - 1; k >= 0; k--) 1360 for (features = Qnil, k = otf_langsys->FeatureCount - 1; k >= 0; k--)
1361 { 1361 {
1362 OTF_TAG_SYM (sym, gsub_gpos->FeatureList.Feature[k].FeatureTag); 1362 l = otf_langsys->FeatureIndex[k];
1363 if (l > gsub_gpos->FeatureList.FeatureCount)
1364 continue;
1365 OTF_TAG_SYM (sym, gsub_gpos->FeatureList.Feature[l].FeatureTag);
1363 features = Fcons (sym, features); 1366 features = Fcons (sym, features);
1364 } 1367 }
1365 if (j >= 0) 1368 if (j >= 0)
1366 OTF_TAG_SYM (sym, otf_script->LangSysRecord[j].LangSysTag); 1369 OTF_TAG_SYM (sym, otf_script->LangSysRecord[j].LangSysTag);
1367 else 1370 else