[dvipdfmx] [PATCH] Embedding of CFF based fonts without Private dictionary

Marcel Fabian Krüger tex at 2krueger.de
Fri Oct 29 01:52:22 CEST 2021


Hi,

some time ago, a dvipdfmx bug got reported on TeX StackExchange
(https://tex.stackexchange.com/questions/610371/fonts-without-bold-italic-xelatex):

When embedding a CFF based OpenType font which does not contain a
Private dictionary, dvipdfmx segfaults due to a dereferenced NULL
pointer.

I'm suggesting the patch below to fix this.

Best regards,
Marcel

---
 texk/dvipdfm-x/cidtype0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/texk/dvipdfm-x/cidtype0.c b/texk/dvipdfm-x/cidtype0.c
index fd00dd7bd..86a90af28 100644
--- a/texk/dvipdfm-x/cidtype0.c
+++ b/texk/dvipdfm-x/cidtype0.c
@@ -1401,7 +1401,11 @@ CIDFont_type0_t1cdofont (pdf_font *font)
   cff_add_string(cffont, "Identity", 1);
 
   cff_dict_update(cffont->topdict, cffont);
-  cff_dict_update(cffont->private[0], cffont);
+
+  if (cffont->private && cffont->private[0]) {
+    cff_dict_update(cffont->private[0], cffont);
+  }
+
   cff_update_string(cffont);
 
   /* CFF code need to be rewrote... */
-- 
2.33.1



More information about the dvipdfmx mailing list.