[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1578-gf1ae75e

[email protected] (Ken Sharp)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  f1ae75eb9d43d9773915ab66b0c97086d0252257 (commit)
      from  fd14a8e3701a7f75d758a1e536bcafbddeb70289 (commit)

----------------------------------------------------------------------
commit f1ae75eb9d43d9773915ab66b0c97086d0252257
Author: Ken Sharp <[email protected]>
Date:   Thu Aug 15 14:36:55 2019 +0100

    ps2write - don't password encrypt PostScript output!
    
    Noticed while testing the args commit; if we set -sOwnerPassword (to
    create a password-protected PDF file), but select (e)ps2write as the
    device, then the resulting PostScript file would have all the streams
    (in a PDF sense) encrypted with PDF password encryption.
    
    Unsurprisingly, this result in a completely unusable PostScript file.
    Lets not permit that....

diff --git a/devices/vector/gdevpdfp.c b/devices/vector/gdevpdfp.c
index 3eaf107..df2ff37 100644
--- a/devices/vector/gdevpdfp.c
+++ b/devices/vector/gdevpdfp.c
@@ -662,6 +662,12 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
     }
     /* Handle the float/double mismatch. */
     pdev->CompatibilityLevel = (int)(cl * 10 + 0.5) / 10.0;
+
+    if (pdev->ForOPDFRead && pdev->OwnerPassword.size != 0) {
+        emprintf(pdev->memory, "\n\tSetting OwnerPassword for PostScript output would result in an encrypted\n\tunusable PostScript file, ignoring.\n");
+        pdev->OwnerPassword.size = 0;
+    }
+
     if(pdev->OwnerPassword.size != save_dev->OwnerPassword.size ||
         (pdev->OwnerPassword.size != 0 &&
          memcmp(pdev->OwnerPassword.data, save_dev->OwnerPassword.data,


Summary of changes:
 devices/vector/gdevpdfp.c | 6 ++++++
 1 file changed, 6 insertions(+)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.