From 989bb5d70e7db6964de2aadfae789cf8869fc108 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Sun, 1 Mar 2015 00:13:53 +0000 Subject: 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. --- source/pdf/pdf-write.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') 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); -- cgit v1.2.3