summaryrefslogtreecommitdiff
path: root/apps/pdfclean.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-11-15 18:38:44 +0000
committerRobin Watts <robin.watts@artifex.com>2011-11-17 18:32:06 +0000
commit9b56c6c88522b7ff6c592c93ff8ec33ee158747a (patch)
tree0eebb4d74c7dd2cb983ea583c83cc4d410251f8f /apps/pdfclean.c
parentdb360fac468dc89b45c89bd30374b61b27c221b1 (diff)
downloadmupdf-9b56c6c88522b7ff6c592c93ff8ec33ee158747a.tar.xz
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.
Diffstat (limited to 'apps/pdfclean.c')
-rw-r--r--apps/pdfclean.c5
1 files changed, 4 insertions, 1 deletions
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();