[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1789-ga6e36c2

[email protected] (Robin Watts) Thu, 31 Oct 2019 19:27:48 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  a6e36c29b69b4d15aac872e37303dcf9cb8d7739 (commit)
      from  dbdb5f8527007b482d4e6037b558dbf3e6a06d3a (commit)

----------------------------------------------------------------------
commit a6e36c29b69b4d15aac872e37303dcf9cb8d7739
Author: Robin Watts <[email protected]>
Date:   Thu Oct 31 19:24:44 2019 +0000

    Update spotcmyk device for new file access security.
    
    This device writes the data to a file, then reads it back in,
    and writes out various spot ".pcx" files. Accordingly we
    need to make the file readable too, and then make the .pcx
    files writable.

diff --git a/base/gdevdevn.c b/base/gdevdevn.c
index d030561..b13e50b 100644
--- a/base/gdevdevn.c
+++ b/base/gdevdevn.c
@@ -1758,12 +1758,19 @@ devn_write_pcx_file(gx_device_printer * pdev, char * filename, int ncomp,
 	goto done;
     }
 
+    code = gs_add_control_path(pdev->memory, gs_permit_file_reading, filename);
+    if (code < 0)
+        goto done;
+
     in = gp_fopen(pdev->memory, filename, "rb");
     if (!in) {
         code = gs_note_error(gs_error_invalidfileaccess);
 	goto done;
     }
     gs_sprintf(outname, "%s.pcx", filename);
+    code = gs_add_control_path(pdev->memory, gs_permit_file_writing, outname);
+    if (code < 0)
+        goto done;
     out = gp_fopen(pdev->memory, outname, "wb");
     if (!out) {
         code = gs_note_error(gs_error_invalidfileaccess);
@@ -1776,6 +1783,8 @@ devn_write_pcx_file(gx_device_printer * pdev, char * filename, int ncomp,
         code = devn_finish_pcx_file(pdev, out, &header, ncomp, bpc);
 
 done:
+    (void)gs_remove_control_path(pdev->memory, gs_permit_file_reading, filename);
+    (void)gs_remove_control_path(pdev->memory, gs_permit_file_writing, outname);
     if (in)
       gp_fclose(in);
     if (out)


Summary of changes:
 base/gdevdevn.c | 9 +++++++++
 1 file changed, 9 insertions(+)