summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2015-03-01 00:13:53 +0000
committerRobin Watts <robin.watts@artifex.com>2015-03-01 00:15:57 +0000
commit989bb5d70e7db6964de2aadfae789cf8869fc108 (patch)
treeeb448d7945908a572c3d780cf62de77d27b8e0e6 /source/pdf
parent8ff8784def2fbf49a303a86259919ff143050c5f (diff)
downloadmupdf-989bb5d70e7db6964de2aadfae789cf8869fc108.tar.xz
Bug 695658: Fix crash with mutool clean -l -a
We were failing to allow for the change in length of the hint stream caused by the ascii encoding when calculating offsets.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-write.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index dc063762..f6886beb 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -2719,6 +2719,11 @@ void pdf_write_document(fz_context *ctx, pdf_document *doc, char *filename, fz_w
opts.file_len = ftell(opts.out);
make_hint_stream(ctx, doc, &opts);
+ if (opts.do_ascii)
+ {
+ opts.hintstream_len *= 2;
+ opts.hintstream_len += 1 + ((opts.hintstream_len+63)>>6);
+ }
opts.file_len += opts.hintstream_len;
opts.main_xref_offset += opts.hintstream_len;
update_linearization_params(ctx, doc, &opts);