File: font-divbyzero.patch

package info (click to toggle)
wine 1.8.7-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,848 kB
  • ctags: 306,666
  • sloc: ansic: 2,517,827; perl: 18,150; yacc: 15,402; makefile: 7,623; objc: 5,762; lex: 4,207; sh: 893; cpp: 816; xml: 78; awk: 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
@@ -5704,6 +5704,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;