summaryrefslogtreecommitdiff
path: root/pango/pango-fontset.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2005-11-23 15:19:48 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2005-11-23 15:19:48 +0000
commita775a8b1b6ddf7b7ca3e5ba649db7d766f99762f (patch)
treecad2b5794f29206d611eed076fe1b6abceebb54d /pango/pango-fontset.c
parent2cd1b4099a4bc48bb2589c52deb11f20c728fb57 (diff)
downloadpango-a775a8b1b6ddf7b7ca3e5ba649db7d766f99762f.tar.gz
Protect against possible division by zeros (#316468, Steve Grubb)
2005-11-23 Behdad Esfahbod <behdad@gnome.org> Protect against possible division by zeros (#316468, Steve Grubb) * pango/pango-context.c (update_metrics_from_items), pango/pango-fontset.c (pango_fontset_real_get_metrics): If count is zero, do not alter approximate_{char,digit}_width. * pango/opentype/disasm.c: Err on invalid DeltaFormat.
Diffstat (limited to 'pango/pango-fontset.c')
-rw-r--r--pango/pango-fontset.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/pango/pango-fontset.c b/pango/pango-fontset.c
index 4f16fa31..a62169a2 100644
--- a/pango/pango-fontset.c
+++ b/pango/pango-fontset.c
@@ -182,8 +182,11 @@ pango_fontset_real_get_metrics (PangoFontset *fontset)
g_hash_table_destroy (fonts_seen);
- metrics->approximate_char_width /= count;
- metrics->approximate_digit_width /= count;
+ if (count)
+ {
+ metrics->approximate_char_width /= count;
+ metrics->approximate_digit_width /= count;
+ }
return metrics;
}