summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2015-08-20 15:52:59 +0100
committerPaul Gardiner <paul.gardiner@artifex.com>2015-08-27 15:16:51 +0100
commite5e3cb777043d6ec4759e9e24950123b70a377e5 (patch)
tree9f84321b5ba2e557717dec4d1126b0630b577735 /source/pdf
parentb3dab7e0ff1db43c5bc2cc306a0f6c1507125c4d (diff)
downloadmupdf-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.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-form.c8
1 files changed, 6 insertions, 2 deletions
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;
}