[Bug 687317] New: EncryptionR=2 doesn't work with Permissions=-44

"Russell Lang" <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <403CECBD.26137.4204F2B3@localhost>
Log message:
Fix pdfwrite allowable Permissions for EncryptionR=2.

DETAILS:
The code was assuming that the extra permissions should be 0's, 
when in fact they should be 1's.  The fixed code is a bit more 
conservative and requires that all reserved bits match the PDF 
specification.

diff -u -r1.89 gdevpdf.c
--- a/gdevpdf.c 13 Feb 2004 08:08:35 -0000      1.89
+++ b/gdevpdf.c 25 Feb 2004 03:33:54 -0000
@@ -545,7 +545,8 @@
        eprintf("PDF encryption key length must be a multiple of 8.\n");
        return_error(gs_error_rangecheck);
     }
-    if (pdev->EncryptionR == 2 && (pdev->Permissions & (0xF << 8))) {
+    if (pdev->EncryptionR == 2 &&
+       ((pdev->Permissions & (0xFFFFFFC3)) != 0xFFFFFFC0)) {
        eprintf("Some of Permissions are not allowed with R=2.\n");
        return_error(gs_error_rangecheck);
     }
Russell Lang                   [email protected]
Ghostgum Software Pty Ltd      http://www.ghostgum.com.au/
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.