diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2015-08-20 15:52:59 +0100 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2015-08-27 15:16:51 +0100 |
commit | e5e3cb777043d6ec4759e9e24950123b70a377e5 (patch) | |
tree | 9f84321b5ba2e557717dec4d1126b0630b577735 | |
parent | b3dab7e0ff1db43c5bc2cc306a0f6c1507125c4d (diff) | |
download | mupdf-e5e3cb777043d6ec4759e9e24950123b70a377e5.tar.xz |
Ensure the unsaved signatures list is held in ascending order
This is work towards bug #696123. It does not fix the bug because, in fact,
saving multiple signatures in one go is not permitted (they need to use
several incremental saves), but we may as well have the order correctly
held.
-rw-r--r-- | include/mupdf/pdf/document.h | 1 | ||||
-rw-r--r-- | source/pdf/pdf-form.c | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h index 8f2c6ef6..668a9d13 100644 --- a/include/mupdf/pdf/document.h +++ b/include/mupdf/pdf/document.h @@ -245,6 +245,7 @@ struct pdf_document_s int recalculating; int dirty; pdf_unsaved_sig *unsaved_sigs; + pdf_unsaved_sig **unsaved_sigs_end; void (*update_appearance)(fz_context *ctx, pdf_document *doc, pdf_annot *annot); diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c index e34d5f4d..5a23786f 100644 --- a/source/pdf/pdf-form.c +++ b/source/pdf/pdf-form.c @@ -1477,6 +1477,10 @@ void pdf_signature_set_value(fz_context *ctx, pdf_document *doc, pdf_obj *field, unsaved_sig = fz_malloc_struct(ctx, pdf_unsaved_sig); unsaved_sig->field = pdf_keep_obj(ctx, field); unsaved_sig->signer = pdf_keep_signer(ctx, signer); - unsaved_sig->next = doc->unsaved_sigs; - doc->unsaved_sigs = unsaved_sig; + unsaved_sig->next = NULL; + if (doc->unsaved_sigs_end == NULL) + doc->unsaved_sigs_end = &doc->unsaved_sigs; + + *doc->unsaved_sigs_end = unsaved_sig; + doc->unsaved_sigs_end = &unsaved_sig->next; } |