Commit 978eefee5401abee6bf702c6bcde9afb47893145

Georg Brandl 2022-04-12T11:43:37

* src/cff/cffgload.c (cff_slot_load) [FT_CONFIG_OPTION_SVG]: Fix segfault. This can happen if the function is called with `size` being `NULL`. Fixes #1147.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 5c15c80..7586b88 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -370,8 +370,8 @@
       SFNT_Service  sfnt;
 
 
-      if ( size->root.metrics.x_ppem < 1 ||
-           size->root.metrics.y_ppem < 1 )
+      if ( size && (size->root.metrics.x_ppem < 1 ||
+                    size->root.metrics.y_ppem < 1 ) )
       {
         error = FT_THROW( Invalid_Size_Handle );
         return error;