Bug 53343 - kghostview doesn't handle new -dSAFER semantics
Summary: kghostview doesn't handle new -dSAFER semantics
Status: RESOLVED FIXED
Alias: None
Product: kghostview
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal with 41 votes (vote)
Target Milestone: ---
Assignee: Wilco Greven
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-24 05:57 UTC by uno
Modified: 2004-02-02 21:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
fse01-flf.pdf (deleted)
2003-03-14 18:59 UTC, klee
Details
test case (78.52 KB, application/pdf)
2003-03-14 19:24 UTC, Luís Pedro Coelho
Details

Note You need to log in before you can comment on or make changes to this bug.
Description uno 2003-01-24 05:57:32 UTC
Version:           0.13.2 (using KDE 3.1.0 (RC6))
Installed from:    compiled sources
Compiler:          gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
OS:          Linux (i686) release 2.4.18-19.8.0

The heading says it all.
Unfortunately I have no idea  what pdf version the files that faile to open has.
But the ones I have encountered starts with:
%PDF-1.3
Comment 1 klee 2003-02-21 02:41:25 UTC
I can confirm, using the KDE 3.1 release.  Actually, I've had this problem as long as I 
can remember using KDE.  (Yes, I should have reported a long time ago; I've been 
using Acrobat instead.)  I can also confirm that this happens with PDF 1.2 files.  
Actually, almost no PDF files in the world that I have ever encountered work with 
kghostview, even the ones that display OK with gv. 
 
More precisely, the file loads, and the correct number of pages are shown in the page 
chooser, but the main window displays a blank page.  This happens when I'm loading 
PDFs over the network, when I'm doing it on a local file system, when I'm doing it on 
an NFS-mounted filesystem, whatever.  It happens when I use the embedded 
kghostviewer component or when I'm using the standalone kghostviewer.  If I load up 
a PostScript file in kghostview, print to PDF, and load up the resulting PDF in 
kghostview, it does not work. 
 
BTW, this may be a duplicate of Bug 22771, but I can't confirm for sure. 
 
When I enable "Show Ghostscript messages in a separate box", load up a PDF file, 
and hit "Redisplay", I get the following messages: 
 
-----------begin messages--------------- 
Error: /invalidfileaccess 
 in --file-- 
 
Operand stack: 
   (/homes/gws/klee/etc/papers/practical-linear-types.pdf)   (r) 
Execution stack: 
   %interp_exit   .runexec2    
--nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   
--nostringval--   --nostringval--    
false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   .runexec2   
--nostringval--   --nostringval--   --nost 
ringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval-- 
Dictionary stack: 
   --dict:1029/1123(ro)(G) 
--   --dict:0/20(G)--   --dict:72/200(L)--   --dict:100/127(ro)(G)--   --dict:221/230(G)-- 
Current allocation mode is local 
AFPL Ghostscript DEVELOPMENT RELEASE  
7.20 
:  
Unrecoverable error, exit code 1 
-----------end messages--------------- 
 
I get at least the "Error: \invalidfileaccess" part of this message pretty consistently 
across the non-working PDF files.  So, you might think this is a ghostscript 
interpreter error, except that gv displays these files just fine.  And it's definitely not the 
PDF file, since xpdf and Acrobat Reader display fine too. 
Comment 2 Luís Pedro Coelho 2003-03-14 12:45:11 UTC
Can someone post such a .pdf file? 
 
Normally attaching it in a mail to 53343@bugs.kde.org should do the trick. 
Comment 3 klee 2003-03-14 18:59:09 UTC
Subject: Re:  Frequently fails to open pdf files         

On 14 Mar 2003, Luis Pedro Coelho wrote:

> ------- Additional Comments From luis_pedro@netcabo.pt  2003-03-14 12:45 -------
> Can someone post such a .pdf file? 
>
> Normally attaching it in a mail to 53343@bugs.kde.org should do the trick.

OK, I've attached one that's relatively small.  You can also view it at:

http://www.ccs.neu.edu/scheme/pubs/fse01-flf.pdf

~k



Created an attachment (id=1170)
fse01-flf.pdf
Comment 4 Luís Pedro Coelho 2003-03-14 19:24:05 UTC
Created attachment 1171 [details]
test case

I had problems with the previous attachment
Comment 5 Luís Pedro Coelho 2003-03-14 19:26:08 UTC
I wasn't able to open the attachment on bugzilla (bc bugzilla was giving me an 
empty file), but the ftp link seemed to work and open on kghostview, so I can't 
reproduce the bug. 
 
I added the file to bugzilla because external test case links often become stale after 
some time. 
Comment 6 klee 2003-03-14 19:28:22 UTC
What ghostview version are you using?  My gs --version says 7.05. 
Comment 7 Luís Pedro Coelho 2003-03-14 20:21:07 UTC
My gs is also 7.05! 
 
I even got kghostview BRANCH and 3.1.0  (everything else (kdelibs,etc.) is from 
HEAD, though) to see if I could make the bug show up. 
 
I always opened the file without any problems. 
Comment 8 klee 2003-03-18 21:52:20 UTC
Subject: Re:  Frequently fails to open pdf files         

OK, it turns out I'm running 7.20 (I had forgotten that some other user
installed 7.20 in our "unsupported software" partition).  The old gs was
in my bash PATH, but the new gs was in the PATH of my KE environment.

Anyway, running kghostview with the debug window yields the spew of error
messages I posted earlier:

  Error: /invalidfileaccess
   in --file--

  ... [lots of error junk] ...

  AFPL Ghostscript DEVELOPMENT RELEASE 
  7.20
  : 
  Unrecoverable error, exit code 1

Given the /invalidfileaccess, I think this problem is related to the new
semantics of -dSAFER in 7.20:

http://www.ghostscript.com/pipermail/gs-devel/2002-April/001499.html

This security change appears to have been propagated into all post-7.20
releases of GhostScript; see the 8.00 docs:

http://www.cs.wisc.edu/~ghost/doc/AFPL/8.00/Use.htm

Searching reveals that kpswidget.cpp always passes -dSAFER.  I believe the
fix is to make kghostview do the right thing w.r.t. the new -dSAFER
semantics, possibly conditionally depending on whether the ghostview
version is post-7.20.  Doing the secure thing appears pretty tricky, but
maybe you could look at what newer versions of gsview do.  Someday, I
assume, the newer versions of gs will be standard everywhere.

~k


Comment 9 Waldo Bastian 2003-04-09 23:09:00 UTC
This is supposed to be fixed with the KDE security update that we have issued 
today. Please test. 
Comment 10 Dirk Mueller 2003-04-09 23:11:55 UTC
reopen when there are still problems after upgrading to 3.0.5b / 3.1.1a.  
Comment 11 Matej Cepl 2004-02-02 21:25:37 UTC
I've got this error message with kghostview from 3.1.4 and Alladin gs 7.04 (the file is http://www.state.ma.us/ccj/download/info502.pdf):

Error: /invalidfileaccess
 in --.libfile--
Operand stack:
   --dict:4/4(L)--   F0   16.08   --dict:9/9(L)--   --dict:9/9(L)--   Arial-BoldItalic   Font   Arial-BoldItalic   387309   Arial-BoldItalic   --nostringval--   Arial-BoldItalic   Arial-BoldItalicMT   (/usr/share/fonts/truetype/microsoft/arialbi.ttf)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--   --nostringval--   --nostringval--   6   8   %oparray_pop   7   8   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push  
 10   9   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --nostringval--   %loop_continue   --nostringval--   14   10   %oparray_pop   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1014/1123(ro)(G)--   --dict:0/20(G)--   --dict:72/200(L)--   --dict:97/127(ro)(G)--   --dict:214/230(ro)(G)--   --dict:19/24(L)--   --dict:4/6(L)--   --dict:23/31(L)--   --dict:17/17(ro)(G)--   --dict:1014/1123(ro)(G)--
Current allocation mode is local
AFPL Ghostscript 7.04: Unrecoverable error, exit code 1

And yes, it display perfectly well with plain gs, gv, or xpdf.

Matej