RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1661210 - ghostscript: Regression: pdf2ps reports an error when reading from stdin (Error: /invalidfileaccess in --run--)
Summary: ghostscript: Regression: pdf2ps reports an error when reading from stdin (Err...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ghostscript
Version: 7.6
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Martin Osvald 🛹
QA Contact: Petr Sklenar
URL:
Whiteboard:
: 1664890 1664980 (view as bug list)
Depends On:
Blocks: 1665919
TreeView+ depends on / blocked
 
Reported: 2018-12-20 12:35 UTC by Peter Oliver
Modified: 2019-08-06 13:13 UTC (History)
4 users (show)

Fixed In Version: ghostscript-9.25-2.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1665919 (view as bug list)
Environment:
Last Closed: 2019-08-06 13:13:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:2281 0 None None None 2019-08-06 13:13:18 UTC

Description Peter Oliver 2018-12-20 12:35:24 UTC
Description of problem:
Command pdf2ps exits 1 when reading from standard input.  Despite this, it produces the expected output apparently correctly.

Version-Release number of selected component (if applicable):
ghostscript-9.07-31.el7_6.6.x86_64

How reproducible:
Always

Steps to Reproduce:
pdf2ps - out.ps < /usr/share/doc/libtasn1-4.10/libtasn1.pdf
(or any other PDF file that you happen to have nearby)

Actual results:
Error: /invalidfileaccess in --run--
Operand stack:
   (/tmp/gs_Xvn1Mk)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   run   --nostringval--   2   %stopped_push   --nostringval--   run   run   false   1   %stopped_push   1907   1   3   %oparray_pop   1906   1   3   %oparray_pop   1887   1   3   %oparray_pop
Dictionary stack:
   --dict:938/1684(ro)(G)--   --dict:1/20(G)--   --dict:77/200(L)--
Current allocation mode is local
GPL Ghostscript 9.07: Unrecoverable error, exit code 1

Expected results:
Command silently exits 0.

Additional info:
This problem doesn't occur with ghostscript-9.07-31.el7.x86_64.

Comment 1 Martin Osvald 🛹 2018-12-20 13:19:33 UTC
Hello,

Thank you very much for reporting this problem!

I am glad to hear that despite the error, it produces the intended output file.

I can reproduce the same and can confirm the problem was introduced with ghostscript-9.07-31.el7_6.1 and that it doesn't happen if the pdf file gets passed through command line argument, but happens when it gets read/redirected through stdin.

I will try to return back to you soon with follow up investigation results.

Kind regards,
-Martin

Comment 2 Martin Osvald 🛹 2018-12-20 14:44:44 UTC
So I found out the culprit patch behind this.


The regression was introduced with backporting of the below upstream patch:

https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=a054156d425b4dbdaaa9fda4b5f1182b27598c2b

to fix CVE-2018-16539 (patchfile: ghostscript-cve-2018-16539.patch).


When I try to build the upstream code checking out exactly that commit, upstream ends with exactly the same error.

This regression was fixed by later upstream commit:

https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=0704d18b10314d701a522ad6c16718e0b8e199b7

I checked it and it fixes this regression.


Side note:

pdf2ps is a wrapper script which calls gs with the below params:

~~~
exec "$GS_EXECUTABLE" $OPTIONS -q -dNOPAUSE -dBATCH -P- -dSAFER -sDEVICE=ps2write "-sOutputFile=$outfile" $OPTIONS -c save pop -f "$1"
~~~

If we remove '-dSAFER', pdf2ps no longer prints the reported error.


I will try to get the fix for this BZ included in the next errata.

Comment 7 Martin Osvald 🛹 2018-12-21 06:00:51 UTC
TEMPORARY WORKAROUND:

- either pass the input file as command line argument instead of letting it be read through stdin
- or ignore the error (the error doesn't look to be influencing contents of the resulting output file)
- or downgrade to ghostscript-9.07-31.el7
- or temporarily remove '-dSAFER' from /usr/bin/pdf2ps

Comment 10 Martin Osvald 🛹 2019-01-10 06:00:40 UTC
*** Bug 1664890 has been marked as a duplicate of this bug. ***

Comment 13 Martin Osvald 🛹 2019-01-10 08:17:28 UTC
*** Bug 1664980 has been marked as a duplicate of this bug. ***

Comment 14 Simon Matter 2019-01-10 08:31:20 UTC
Hi Martin,

You wrote, as a temporary workaround, one can
- or ignore the error (the error doesn't look to be influencing contents of the resulting output file)

That's problematic because depending on how you call pdf2ps, the error message above is included in the output file.
If you do "cat in.pdf | pdf2ps - - > out.ps", then the error is included at the top of out.ps.

So, piping a pdf through pdf2ps results in an invalid ps output stream.

Comment 15 Martin Osvald 🛹 2019-01-10 08:51:52 UTC
(In reply to Simon Matter from comment #14)
> If you do "cat in.pdf | pdf2ps - - > out.ps", then the error is included at
> the top of out.ps.
> 
> So, piping a pdf through pdf2ps results in an invalid ps output stream.

yes, in this case, you need to specify an output file argument for pdf2ps to workaround it

Comment 26 errata-xmlrpc 2019-08-06 13:13:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2281


Note You need to log in before you can comment on or make changes to this bug.