From: Behdad Esfahbod Date: Wed, 28 Jan 2009 23:27:13 +0000 (+0000) Subject: Bug 567392 – Abiword crashes in pango when opening document with certain X-Git-Tag: 1.23.0~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a9cc36f7002a5f9421dd8788a320f3bd448cf65;p=platform%2Fupstream%2Fpango.git Bug 567392 – Abiword crashes in pango when opening document with certain 2009-01-28 Behdad Esfahbod Bug 567392 – Abiword crashes in pango when opening document with certain locales * pango/pango-ot-info.c (pango_ot_info_find_language), (pango_ot_info_find_feature), (pango_ot_info_list_languages), (pango_ot_info_list_features): Protect against more broken fonts. svn path=/trunk/; revision=2813 --- diff --git a/ChangeLog b/ChangeLog index 3eaf8b7..a23b1ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2009-01-28 Behdad Esfahbod + Bug 567392 – Abiword crashes in pango when opening document with + certain locales + + * pango/pango-ot-info.c (pango_ot_info_find_language), + (pango_ot_info_find_feature), (pango_ot_info_list_languages), + (pango_ot_info_list_features): Protect against more broken fonts. + +2009-01-28 Behdad Esfahbod + * configure.in: Bump version to 1.23.0. Not releasing yet. 2009-01-27 Behdad Esfahbod diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c index e581aea..51a8d44 100644 --- a/pango/pango-ot-info.c +++ b/pango/pango-ot-info.c @@ -522,7 +522,6 @@ pango_ot_info_find_language (PangoOTInfo *info, return FALSE; g_return_val_if_fail (script_index < script_list->ScriptCount, FALSE); - script = &script_list->ScriptRecord[script_index].Script; for (i = 0; i < script->LangSysCount; i++) @@ -610,7 +609,6 @@ pango_ot_info_find_feature (PangoOTInfo *info, return FALSE; g_return_val_if_fail (script_index < script_list->ScriptCount, FALSE); - script = &script_list->ScriptRecord[script_index].Script; if (language_index == PANGO_OT_DEFAULT_LANGUAGE) @@ -625,7 +623,8 @@ pango_ot_info_find_feature (PangoOTInfo *info, { HB_UShort index = lang_sys->FeatureIndex[i]; - if (feature_list->FeatureRecord[index].FeatureTag == feature_tag) + if (index < feature_list->FeatureCount && + feature_list->FeatureRecord[index].FeatureTag == feature_tag) { if (feature_index) *feature_index = index; @@ -706,7 +705,6 @@ pango_ot_info_list_languages (PangoOTInfo *info, return NULL; g_return_val_if_fail (script_index < script_list->ScriptCount, NULL); - script = &script_list->ScriptRecord[script_index].Script; result = g_new (PangoOTTag, script->LangSysCount + 1); @@ -748,7 +746,7 @@ pango_ot_info_list_features (PangoOTInfo *info, HB_ScriptTable *script; HB_LangSys *lang_sys; - int i; + int i, j; g_return_val_if_fail (PANGO_IS_OT_INFO (info), NULL); @@ -763,7 +761,6 @@ pango_ot_info_list_features (PangoOTInfo *info, return NULL; g_return_val_if_fail (script_index < script_list->ScriptCount, NULL); - script = &script_list->ScriptRecord[script_index].Script; if (language_index == PANGO_OT_DEFAULT_LANGUAGE) @@ -776,14 +773,16 @@ pango_ot_info_list_features (PangoOTInfo *info, result = g_new (PangoOTTag, lang_sys->FeatureCount + 1); + j = 0; for (i = 0; i < lang_sys->FeatureCount; i++) { HB_UShort index = lang_sys->FeatureIndex[i]; - result[i] = feature_list->FeatureRecord[index].FeatureTag; + if (index < feature_list->FeatureCount) + result[j++] = feature_list->FeatureRecord[index].FeatureTag; } - result[i] = 0; + result[j] = 0; return result; }