Sophie

Sophie

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

ghostscript-10.00.0-6.mga9.src.rpm

From 664d478c19a324d73c61947d6083a4b663509f34 Mon Sep 17 00:00:00 2001
From: Ken Sharp <ken.sharp@artifex.com>
Date: Thu, 22 Sep 2022 11:48:57 +0100
Subject: [PATCH 110/155] GhostPDF - Fix crash with -dPDFINFO

Stems from bug #705897 (which is not a GS bug report). The file for
that report has a Resource with a Font which points to a non-Font
dictionary.

The font resource checking was incorrectly using a return value of >= 0
from pdfi_dict_knownget_type() to indicate that a Subtype key is
present in the dictionary, the function actually returns > 0 if it is
present and 0 if it is not.

Which caused the code to try and use the non-existent key.
---
 pdf/pdf_check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pdf/pdf_check.c b/pdf/pdf_check.c
index e71b749cc..dbbb03478 100644
--- a/pdf/pdf_check.c
+++ b/pdf/pdf_check.c
@@ -913,7 +913,7 @@ static int pdfi_check_Font(pdf_context *ctx, pdf_dict *font, pdf_dict *page_dict
 
 
         code = pdfi_dict_knownget_type(ctx, font, "Subtype", PDF_NAME, &array_obj);
-        if (code >= 0) {
+        if (code > 0) {
             code = pdfi_dict_put(ctx, font_info_dict, "Subtype", array_obj);
             if (code < 0) {
                 pdfi_countdown(array_obj);
-- 
2.30.4