[PATCH] dlls/gdi32/fretype.c: Avoid division by zero.

max at mtew.isa-geek.net max at mtew.isa-geek.net
Fri May 3 21:07:41 CDT 2013


From: Max TenEyck Woodbury <max+git at mtew.isa-geek.net>

---
 dlls/gdi32/freetype.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index c30a358..9490e41 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6773,10 +6773,9 @@ static BOOL get_text_metrics(GdiFont *font, LPTEXTMETRICW ptm)
         if (!get_outline_text_metrics(font) && !get_bitmap_text_metrics(font)) return FALSE;
 
         /* Make sure that the font has sane width/height ratio */
-        if (font->aveWidth)
-        {
-            if ((font->aveWidth + font->potm->otmTextMetrics.tmHeight - 1) / font->potm->otmTextMetrics.tmHeight > 100)
-            {
+        if ( font->aveWidth && font->potm->otmTextMetrics.tmHeight ) {
+            if (((font->aveWidth + font->potm->otmTextMetrics.tmHeight - 1) /
+                 font->potm->otmTextMetrics.tmHeight) > 100) {
                 WARN("Ignoring too large font->aveWidth %d\n", font->aveWidth);
                 font->aveWidth = 0;
             }
-- 
1.7.7.6




More information about the wine-patches mailing list