File: font-divbyzero.patch

package info (click to toggle)
wine-development 2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 187,144 kB
  • ctags: 315,546
  • sloc: ansic: 2,640,448; perl: 18,914; yacc: 15,420; makefile: 8,447; objc: 6,157; lex: 4,268; sh: 886; cpp: 816; awk: 69; xml: 69
file content (20 lines) | stat: -rw-r--r-- 808 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
description: avoid divide-by-zero condition for certain font files and warn about it
bug: https://bugs.winehq.org/show_bug.cgi?id=38762
bug-debian: https://bugs.debian.org/788809

--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -5720,6 +5720,13 @@ found_face:
         if (scale > 2 && scaled_height - height > face->size.height / 4) scale--;
         /* The jump between unscaled and doubled is delayed by 1 */
         else if (scale == 2 && scaled_height - height > (face->size.height / 4 - 1)) scale--;
+
+        if (face->size.height == 0) {
+            scale = 1;
+            WARN("the font file %s (%s) has zero face height!\n",
+                 debugstr_w(face->file), debugstr_w(face->FullName));
+        }
+
         ret->scale_y = scale;
 
         width = face->size.x_ppem >> 6;