<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Index: kgv_miniwidget.cpp
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kgv_miniwidget.cpp,v
retrieving revision 1.100.2.3
diff -u -r1.100.2.3 kgv_miniwidget.cpp
--- kgv_miniwidget.cpp	27 Sep 2002 02:39:53 -0000	1.100.2.3
+++ kgv_miniwidget.cpp	6 Apr 2003 21:32:09 -0000
@@ -603,10 +603,16 @@
 {
     KProcess process;
     process &lt;&lt; _interpreterPath
+	    &lt;&lt; "-dSAFER"
+	    &lt;&lt; "-dPARANOIDSAFER"
+	    &lt;&lt; "-dDELAYSAFER"
 	    &lt;&lt; "-dNODISPLAY" 
 	    &lt;&lt; "-dQUIET" 
 	    &lt;&lt; QString( "-sPDFname=%1" ).arg( pdfName )
 	    &lt;&lt; QString( "-sDSCname=%1" ).arg( dscName )
+            &lt;&lt; "-c"
+            &lt;&lt; "&lt;&lt; /PermitFileReading [ PDFname ] /PermitFileWriting [ DSCname ] /PermitFileControl [] &gt;&gt; setuserparams .locksafe"
+            &lt;&lt; "-f"
 	    &lt;&lt; "pdf2dsc.ps"
 	    &lt;&lt; "-c"
 	    &lt;&lt; "quit";
@@ -968,7 +974,7 @@
 	    } 
 	
 	// Set 0 filename for gs -- use pipe.
-	page-&gt;setFileName( QString::null );
+	page-&gt;setFileName( format == PDF ? _pdfFileName : _fileName, true );
       
 	// finally set marked list
 	QString s, tip;
@@ -987,7 +993,7 @@
     else {
 	toc_length = 0;
 	toc_entry_length = 3;
-	page-&gt;setFileName( _fileName );
+	page-&gt;setFileName( _fileName, false );
 	QString s("1");
 	_marklist-&gt;insertItem( s, 0 );
     }
@@ -1066,11 +1072,11 @@
 	}
 	
 	const char *cmd_convert_pdf = 
-		"%s -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pswrite -sOutputFile=%s -c save pop -f \"%s\"";
+		"%s -q -dNOPAUSE -dBATCH -dSAFER -dPARANOIDSAFER -sDEVICE=pswrite -sOutputFile=%s -c save pop -f %s";
 	QCString cmd;
 	cmd.sprintf( cmd_convert_pdf, _interpreterPath.local8Bit().data(),
 		QFile::encodeName( _tmpFromPDF-&gt;name() ).data(), 
-		QFile::encodeName( _pdfFileName ).data() );
+		QFile::encodeName( KShellProcess::quote(_pdfFileName) ).data() );
   
 	// TODO -- timeout/fail on this conversion (it can hang on a bad pdf)
 	// TODO -- use output from gs (leave out -q) to drive a progress bar
Index: kpswidget.cpp
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kpswidget.cpp,v
retrieving revision 1.66
diff -u -r1.66 kpswidget.cpp
--- kpswidget.cpp	29 May 2001 00:49:46 -0000	1.66
+++ kpswidget.cpp	6 Apr 2003 21:32:09 -0000
@@ -222,9 +222,10 @@
  * Sets the filename of the ghostscript input. Usually we use a pipe for
  * communication and no filename will be needed.
  */
-void KPSWidget::setFileName( const QString&amp; fileName )
+void KPSWidget::setFileName( const QString&amp; fileName, bool usePipe )
 {
     _fileName = fileName;
+    _usePipe = usePipe;
 }
 
 void KPSWidget::setOrientation( KGV::Orientation orientation )
@@ -488,9 +489,12 @@
 
     if( !intConfig-&gt;platformFonts() )
 	*_process &lt;&lt; "-dNOPLATFONTS";
-    *_process &lt;&lt; "-dNOPAUSE" &lt;&lt; "-dQUIET" &lt;&lt; "-dSAFER";
-    if( _fileName.isEmpty() )
-	*_process &lt;&lt; "-";
+    *_process &lt;&lt; "-dNOPAUSE" &lt;&lt; "-dQUIET" &lt;&lt; "-dSAFER" &lt;&lt; "-dPARANOIDSAFER";
+    if( _usePipe )
+        *_process &lt;&lt;
+        // The following two lines are their to ensure that we are allowed to read _fileName
+        "-dDELAYSAFER" &lt;&lt; "-sInputFile="+_fileName &lt;&lt; "-c" &lt;&lt;
+        "&lt;&lt; /PermitFileReading [ InputFile ] /PermitFileWriting [] /PermitFileControl [] &gt;&gt; setuserparams .locksafe";
     else 
 	*_process &lt;&lt; _fileName &lt;&lt; "-c" &lt;&lt; "quit";
 
@@ -517,8 +521,8 @@
 
     // Finally fire up the interpreter.
     kdDebug(4500) &lt;&lt; "KPSWidget: starting interpreter" &lt;&lt; endl;
-    if( _process-&gt;start( KProcess::NotifyOnExit, _fileName.isEmpty() 
-		? KProcess::All : KProcess::AllOutput ) ) {
+    if( _process-&gt;start( KProcess::NotifyOnExit, 
+    		_usePipe ? KProcess::All : KProcess::AllOutput ) ) {
 	_stdinReady = true;
 	_interpreterReady = false;
     }
Index: kpswidget.h
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kpswidget.h,v
retrieving revision 1.37
diff -u -r1.37 kpswidget.h
--- kpswidget.h	27 May 2001 11:50:52 -0000	1.37
+++ kpswidget.h	6 Apr 2003 21:32:09 -0000
@@ -73,7 +73,7 @@
     bool nextPage();
     bool sendPS( FILE* fp, const KGV::FileOffset&amp;, bool close);
     
-    void setFileName( const QString&amp; );
+    void setFileName( const QString&amp;, bool usePipe );
 
     void setPageSize( const QSize&amp; );
     QSize pageSize() const { return _pageSize; }
@@ -149,6 +149,7 @@
     KGV::Orientation _orientation;
     bool show_messages;
     QString _fileName;
+    bool _usePipe;
 
     bool _stdinReady;
     bool _interpreterBusy;
</pre></body></html>