From 9b56c6c88522b7ff6c592c93ff8ec33ee158747a Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 15 Nov 2011 18:38:44 +0000 Subject: Fix bug 692627; pdfclean -ggg of encrypted files fails. Encryption bakes the object numbers into the strings/streams. This means that our renumbering technique falls down; when we move an object to its new position, then come to read it, we find that it decrypts badly. The fix here is (as suggested by Zeniko) to avoid renumbering when encryption is in use. --- apps/pdfclean.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apps/pdfclean.c') diff --git a/apps/pdfclean.c b/apps/pdfclean.c index dd85b1a4..f46c4b76 100644 --- a/apps/pdfclean.c +++ b/apps/pdfclean.c @@ -754,7 +754,10 @@ int main(int argc, char **argv) compactxref(); /* Make renumbering affect all indirect references and update xref */ - if (dogarbage >= 2) + /* Do not renumber objects if encryption is in use, as the object + * numbers are baked into the streams/strings, and we can't currently + * cope with moving them. See bug 692627. */ + if (dogarbage >= 2 && xref->crypt == NULL) renumberobjs(); writepdf(); -- cgit v1.2.3