summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2006-03-01 00:26:07 +0000
committerTor Lillqvist <tml@src.gnome.org>2006-03-01 00:26:07 +0000
commit6a281140641872ed0c6d323b06304cca57cdc9e1 (patch)
tree5e081c28f7957d07c004956d653133f202918f71
parentc44718c43a88b0d2655cf98ffb580e9a801f6c45 (diff)
downloadpango-6a281140641872ed0c6d323b06304cca57cdc9e1.tar.gz
Check the font pointer being NULL to avoid crashes for at least one class
2006-03-01 Tor Lillqvist <tml@novell.com> * pango/pango-context.c (update_metrics_from_items): Check the font pointer being NULL to avoid crashes for at least one class of "bad" fonts (those without a Unicode cmap) on Win32. It would probably be better to prune out such fonts already in the enumeration phase. That would require opening (CreateFontIndirect) every font, though, to be able to check with GetFontData() whether there is a Unicode cmap. Don't know how much that would slow down the enumeration.
-rw-r--r--ChangeLog11
-rw-r--r--pango/pango-context.c2
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c90d825..93467224 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-03-01 Tor Lillqvist <tml@novell.com>
+
+ * pango/pango-context.c (update_metrics_from_items): Check the
+ font pointer being NULL to avoid crashes for at least one class of
+ "bad" fonts (those without a Unicode cmap) on Win32. It would
+ probably be better to prune out such fonts already in the
+ enumeration phase. That would require opening (CreateFontIndirect)
+ every font, though, to be able to check with GetFontData() whether
+ there is a Unicode cmap. Don't know how much that would slow down
+ the enumeration.
+
2006-02-28 Tor Lillqvist <tml@novell.com>
* pango/pangowin32-private.h (PING)
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 49db52a9..0e3fb1e5 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -1310,7 +1310,7 @@ update_metrics_from_items (PangoFontMetrics *metrics,
PangoItem *item = l->data;
PangoFont *font = item->analysis.font;
- if (g_hash_table_lookup (fonts_seen, font) == NULL)
+ if (font != NULL && g_hash_table_lookup (fonts_seen, font) == NULL)
{
PangoFontMetrics *raw_metrics = pango_font_get_metrics (font, language);
g_hash_table_insert (fonts_seen, font, font);