Previously the contents of pdf_set_annot_appearance()
is enclosed in begin/end annotation operation calls, while
pdf_set_annot_appearance_from_display_list() does not.
This causes a problem when a user tries to set an annotation
appearance using a display list that causes a new external
graphics state PDF object to be created in pdf_dev_alpha().
When pdf_add_object() is called without being bracketed by
begin/end operation which it continues to call
pdf_create_object() which ends up calling
pdf_add_journal_fragment(). This function will segfault because
it assumes doc->journal->current being non-NULL, which is not
true unless the call is enclosed by begin/end operation.
This commit fixes the issue by adding calls to being_annot_op()
and end_annot_op() to the top-level function
pdf_set_annot_appearance_from_display_list().
fz_var(contents);
fz_var(res);
+ begin_annot_op(ctx, annot, "Set appearance stream");
+
fz_try(ctx)
{
res = pdf_new_dict(ctx, doc, 1);
fz_drop_device(ctx, dev);
fz_drop_buffer(ctx, contents);
pdf_drop_obj(ctx, res);
+ end_annot_op(ctx, annot);
}
fz_catch(ctx)
fz_rethrow(ctx);