diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2018-10-02 02:36:22 +0800 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-10-23 18:46:01 +0200 |
commit | 3b70f431e4b6064118f57b861efa0eb213d811d7 (patch) | |
tree | 08931336e38c1b25ec3df71b9adf27eda127dfc0 | |
parent | 6c85d80ff7e8b1074553a4f6fb895c3aecd3d6aa (diff) | |
download | mupdf-3b70f431e4b6064118f57b861efa0eb213d811d7.tar.xz |
Drop page upon exception cleaning content streams.
-rw-r--r-- | source/pdf/pdf-write.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c index 1849b48b..b27f9070 100644 --- a/source/pdf/pdf-write.c +++ b/source/pdf/pdf-write.c @@ -2766,14 +2766,20 @@ static void clean_content_streams(fz_context *ctx, pdf_document *doc, int saniti { pdf_annot *annot; pdf_page *page = pdf_load_page(ctx, doc, i); - pdf_clean_page_contents(ctx, doc, page, NULL, NULL, NULL, sanitize, ascii); - for (annot = pdf_first_annot(ctx, page); annot != NULL; annot = pdf_next_annot(ctx, annot)) + fz_try(ctx) { - pdf_clean_annot_contents(ctx, doc, annot, NULL, NULL, NULL, sanitize, ascii); - } + pdf_clean_page_contents(ctx, doc, page, NULL, NULL, NULL, sanitize, ascii); - fz_drop_page(ctx, &page->super); + for (annot = pdf_first_annot(ctx, page); annot != NULL; annot = pdf_next_annot(ctx, annot)) + { + pdf_clean_annot_contents(ctx, doc, annot, NULL, NULL, NULL, sanitize, ascii); + } + } + fz_always(ctx) + fz_drop_page(ctx, &page->super); + fz_catch(ctx) + fz_rethrow(ctx); } } |