From b59ff4e3956d8e62b6b76a0e23697b15bc8c9467 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 7 Feb 2018 17:15:54 +0100 Subject: Fix 698918: Use encryption when doing initial object formatting to count the length. --- source/pdf/pdf-object.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source/pdf') diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c index 056d6a73..0c60c228 100644 --- a/source/pdf/pdf-object.c +++ b/source/pdf/pdf-object.c @@ -2130,10 +2130,9 @@ int pdf_print_encrypted_obj(fz_context *ctx, fz_output *out, pdf_obj *obj, int t char *ptr; int n; - n = pdf_sprint_obj(ctx, NULL, 0, obj, tight); - if ((n + 1) < sizeof buf) + n = pdf_sprint_encrypted_obj(ctx, buf, sizeof buf, obj, tight, crypt, num, gen); + if (n <= sizeof buf) { - pdf_sprint_encrypted_obj(ctx, buf, sizeof buf, obj, tight, crypt, num, gen); fz_write_data(ctx, out, buf, n); } else -- cgit v1.2.3