diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-12-23 18:16:30 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-12-23 18:18:36 +0000 |
commit | 3328de5f6432ee25525dca59d4e60d2603477b81 (patch) | |
tree | d1e4162f976a2cf92357501363be48d3a80f6734 /source | |
parent | a79309e9ed72d363b8615bcf9c0b56ddca7864eb (diff) | |
download | mupdf-3328de5f6432ee25525dca59d4e60d2603477b81.tar.xz |
Bug 694712: Do not create empty Contents stream for new pages.
Empty Contents streams are not valid - they need a length at least.
The alternative approach would be to put /Length 0 and update it
later.
Diffstat (limited to 'source')
-rw-r--r-- | source/pdf/pdf-page.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c index 602564ce..0be194e3 100644 --- a/source/pdf/pdf-page.c +++ b/source/pdf/pdf-page.c @@ -603,15 +603,13 @@ pdf_page * pdf_create_page(pdf_document *doc, fz_rect mediabox, int res, int rotate) { pdf_page *page = NULL; - pdf_obj *pageobj, *obj; + pdf_obj *pageobj; float userunit = 1; fz_context *ctx = doc->ctx; fz_matrix ctm, tmp; fz_rect realbox; page = fz_malloc_struct(ctx, pdf_page); - obj = NULL; - fz_var(obj); fz_try(ctx) { @@ -646,16 +644,12 @@ pdf_create_page(pdf_document *doc, fz_rect mediabox, int res, int rotate) fz_pre_scale(fz_translate(&tmp, -realbox.x0, -realbox.y0), userunit, userunit); fz_concat(&ctm, &ctm, &tmp); page->ctm = ctm; - obj = pdf_new_dict(doc, 4); - page->contents = pdf_new_ref(doc, obj); - pdf_drop_obj(obj); - obj = NULL; - pdf_dict_puts(pageobj, "Contents", page->contents); + /* Do not create a Contents, as an empty Contents dict is not + * valid. See Bug 694712 */ } fz_catch(ctx) { pdf_drop_obj(page->me); - pdf_drop_obj(obj); fz_free(ctx, page); fz_rethrow_message(ctx, "Failed to create page"); } |