Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > bc219369320b6b5781eed48254462cef > files > 6

ghostscript-9.25-1.2.mga6.src.rpm

From 18e8a06bd34bb51c08760b7ebdbab68ab45712c1 Mon Sep 17 00:00:00 2001
From: Nancy Durgin <nancy.durgin@artifex.com>
Date: Wed, 19 Sep 2018 18:21:02 -0700
Subject: [PATCH] Bug 699793: Fix handling of .needinput if used from
 interpreter

.needinput is meant as an internal function, but it is exposed
to the user.  I couldn't see an easy way to undefine it.

But if user calls it, it returns gs_error_Fatal in a place that the
code wasn't expecting, and basically puts things in an undefined
state.  This change returns a Fatal error at this point, instead.
---
 psi/imain.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/psi/imain.c b/psi/imain.c
index 9fc72bb..f8fae98 100644
--- a/psi/imain.c
+++ b/psi/imain.c
@@ -606,8 +606,15 @@ gs_main_run_string_with_length(gs_main_instance * minst, const char *str,
                                        pexit_code, perror_object);
     if (code != gs_error_NeedInput)
         return code;
-    return gs_main_run_string_end(minst, user_errors,
+
+    code = gs_main_run_string_end(minst, user_errors,
                                   pexit_code, perror_object);
+    /* Not okay for user to use .needinput
+     * This treats it as a fatal error.
+     */
+    if (code == gs_error_NeedInput)
+        return_error(gs_error_Fatal);
+    return code;
 }
 
 /* Set up for a suspendable run_string. */
-- 
2.9.1