FW: Using Pipes with GS 9.50 and -dSAFER

Sheri Steeves <[email protected]> Mon, 4 Nov 2019 14:27:37 +0000
Newsgroups gmane.comp.printing.ghostscript.devel
Message-ID <[email protected]>
-----Original Message-----
From: Sheri Steeves=20
Sent: October 29, 2019 3:36 PM
To: 'Robin Watts' <[email protected]>
Subject: RE: [gs-devel] Using Pipes with GS 9.50 and -dSAFER

Thanks for the quick reply. I tried the following, neither of them successf=
ul.=20

sprintf(pBuf, "--permit-file-all=3D C:\\Test\\;C:\\Users\\ssteeves\\AppData=
\\Local\\Temp;%%handle%%%p", m_hGSPipeWriter); gsargv[i++] =3D pBuf; =20

sprintf(pBuf, "--permit-file-all=3D C:\\Test\\;C:\\Users\\ssteeves\\AppData=
\\Local\\Temp;%handle%%p", m_hGSPipeWriter); gsargv[i++] =3D pBuf; =20

gsargv[i++] =3D "--permit-file-all=3D%%handle%%"; gsargv[i++] =3D "--permit=
-file-all=3D%handle%";

The issue is the handle, as the file the error message is referencing is my=
 pipe handle, I confirmed this through the debugger.

GPL Ghostscript 9.50: **** Could not open the file 000006D0 .
	Error: /invalidfileaccess in --showpage--
=09

Sheri=20

-----Original Message-----
From: Robin Watts [mailto:[email protected]]
Sent: October 29, 2019 2:52 PM
To: Sheri Steeves <[email protected]>; '[email protected]' <=
[email protected]>
Subject: Re: [gs-devel] Using Pipes with GS 9.50 and -dSAFER

On 29/10/2019 18:21, Sheri Steeves wrote:
> We have existing code using the command line arguments and=20
> gs_init_args with Ghostscript to convert a PDF or a PostScript into a Win=
dows bitmap.
>=20
> With the latest version, GS 9.50, this code fails and I'm pretty sure=20
> I'm hitting issues with the new file path restrictions.
>=20
> The error messages are as follows:
>=20
> GPL Ghostscript 9.50: **** Could not open the file 0000083C .
>=20
>  =A0=A0=A0=A0=A0 Error: /invalidfileaccess in --showpage-
>=20
> I tried adding the appropriate paths hardcoded as a test (gsargv[i++]=20
> =3D
> "--permit-file-all=3DC:\\Test;C:\\Users\\User\\AppData\\Local\\Temp";)
> but still got the same error messages.

So you're specifying the OutputFile as:

   -sOutputFile=3D%handle%%p

I'd therefore suggest:

  --permit-file-all=3D%handle%%p

to match that?

Give that a whirl, and let us know what you get.

Robin