diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-07-13 18:11:45 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-07-13 18:22:32 +0100 |
commit | 21e188013cc9535c8e8615d58a4afa3bca65f544 (patch) | |
tree | 951b4f43bc8be18854c9fd55169ff3d9fc1aaf8e | |
parent | ab770bef466d03bfcabef6d4429efc1e8d50557f (diff) | |
download | mupdf-21e188013cc9535c8e8615d58a4afa3bca65f544.tar.xz |
Bug 696892: PDF annotation appearance stream synthesis SEGV
The code would SEGV if we were trying to synthesise an appearance
stream for an annotation, and the docs pdf resources table
had not been initialised.
We now intialise the pdf resource tables when we initialise a
pdf device. This is the earliest point we know we are going to
need them, and covers all cases.
-rw-r--r-- | source/pdf/pdf-device.c | 5 | ||||
-rw-r--r-- | source/pdf/pdf-xref.c | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c index 3b974efe..2324dbd7 100644 --- a/source/pdf/pdf-device.c +++ b/source/pdf/pdf-device.c @@ -1127,6 +1127,11 @@ fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, const fz_matri if (topctm != &fz_identity) fz_buffer_printf(ctx, buf, "%M cm\n", topctm); + + /* Initialise the resource tables if we have not done so + * already. */ + if (doc->resources == NULL) + pdf_init_resource_tables(ctx, doc); } fz_catch(ctx) { diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index 01b72d04..576c315d 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -2770,7 +2770,6 @@ pdf_document *pdf_create_document(fz_context *ctx) doc->num_incremental_sections = 0; doc->xref_base = 0; doc->disallow_new_increments = 0; - pdf_init_resource_tables(ctx, doc); 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)); |