From 0b457a5fd70dbc65fc114e0b4ff2a7bb607b22ad Mon Sep 17 00:00:00 2001 From: Simon Reinhardt Date: Tue, 20 Oct 2015 16:12:34 +0200 Subject: Fix signatures for files created with pdf_create_document. See Bug 696284. Do not set disallow_new_increments in pdf_create_document, as this breaks following calls to pdf_sign_signature. See also the comments in bug 696251. --- source/pdf/pdf-xref.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/pdf') diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index 29439926..f65edefc 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -2744,7 +2744,7 @@ pdf_document *pdf_create_document(fz_context *ctx) doc->num_xref_sections = 0; doc->num_incremental_sections = 0; doc->xref_base = 0; - doc->disallow_new_increments = 1; + doc->disallow_new_increments = 0; pdf_get_populating_xref_entry(ctx, doc, 0); trailer = pdf_new_dict(ctx, doc, 2); pdf_dict_put_drop(ctx, trailer, PDF_NAME_Size, pdf_new_int(ctx, doc, 3)); @@ -2760,8 +2760,8 @@ pdf_document *pdf_create_document(fz_context *ctx) pdf_dict_put_drop(ctx, pages, PDF_NAME_Type, PDF_NAME_Pages); pdf_dict_put_drop(ctx, pages, PDF_NAME_Count, pdf_new_int(ctx, doc, 0)); pdf_dict_put_drop(ctx, pages, PDF_NAME_Kids, pdf_new_array(ctx, doc, 1)); - pdf_set_populating_xref_trailer(ctx, doc, trailer); - pdf_drop_obj(ctx, trailer); + /* Set the trailer of the final xref section. */ + doc->xref_sections[0].trailer = trailer; } fz_catch(ctx) { -- cgit v1.2.3