Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > d3fc76fe325ca661cb5adbf012153e1c > files > 11

ghostscript-10.00.0-6.mga9.src.rpm

From b34b47f964f37fab4f53ca6637604af9fbfe0c24 Mon Sep 17 00:00:00 2001
From: Chris Liddell <chris.liddell@artifex.com>
Date: Mon, 10 Oct 2022 14:41:11 +0100
Subject: [PATCH 139/155] Bug 705968: Fix bad strategy for TTF Encoding in
 broken files.

In error, the code for the fallback strategy for coping with a missing or
broken Encoding for TTF fonts had been moved after some other operations,
meaning that the error code it relied upon no longer related to building the
encoding array.
---
 pdf/pdf_fontTT.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/pdf/pdf_fontTT.c b/pdf/pdf_fontTT.c
index d7d43e626..e4540d244 100644
--- a/pdf/pdf_fontTT.c
+++ b/pdf/pdf_fontTT.c
@@ -691,16 +691,21 @@ pdfi_copy_truetype_font(pdf_context *ctx, pdf_font *spdffont, pdf_dict *font_dic
         else if (pdfi_type_of(tmp) == PDF_DICT && (font->descflags & 4) != 0) {
             code = pdfi_create_Encoding(ctx, tmp, (pdf_obj *)spdffont->Encoding, (pdf_obj **) &font->Encoding);
         }
+        else {
+            code = gs_error_undefined;
+        }
         pdfi_countdown(tmp);
         tmp = NULL;
     }
     else {
         pdfi_countdown(tmp);
         tmp = NULL;
-        code = 0;
+        code = gs_error_undefined;
     }
+
     if (code < 0) {
-        goto error;
+        font->Encoding = spdffont->Encoding;
+        pdfi_countup(font->Encoding);
     }
 
     /* Since various aspects of the font may differ (widths, encoding, etc)
@@ -715,11 +720,6 @@ pdfi_copy_truetype_font(pdf_context *ctx, pdf_font *spdffont, pdf_dict *font_dic
         goto error;
     }
 
-    if (code <= 0) {
-        font->Encoding = spdffont->Encoding;
-        pdfi_countup(font->Encoding);
-    }
-
     if (ctx->args.ignoretounicode != true) {
         code = pdfi_dict_get(ctx, font_dict, "ToUnicode", (pdf_obj **)&tmp);
         if (code >= 0 && pdfi_type_of(tmp) == PDF_STREAM) {
-- 
2.30.4