diff options
author | Robin Watts <robin.watts@artifex.com> | 2014-09-05 20:26:41 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-09-09 15:53:52 +0100 |
commit | 9172100d6d9f2f5aa4594aaa130fbfaef7162afd (patch) | |
tree | 607402c0f0e9a1f7a5e15518515c41e44e3290c1 /source/pdf/pdf-interpret.c | |
parent | a55648c9d009cdd94977fc5b7152932e59c975ad (diff) | |
download | mupdf-9172100d6d9f2f5aa4594aaa130fbfaef7162afd.tar.xz |
test-device: Abort interpretation when color found.
Add a new class of errors and use them to abort interpretation when
the test device detects a color page.
Diffstat (limited to 'source/pdf/pdf-interpret.c')
-rw-r--r-- | source/pdf/pdf-interpret.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c index 507bf0fa..a6b211dd 100644 --- a/source/pdf/pdf-interpret.c +++ b/source/pdf/pdf-interpret.c @@ -252,6 +252,7 @@ pdf_run_keyword(pdf_csi *csi, char *buf) } fz_catch(ctx) { + fz_rethrow_if(ctx, FZ_ERROR_ABORT); switch (op) { case PDF_OP_Do: @@ -452,17 +453,23 @@ pdf_process_stream(pdf_csi *csi, pdf_lexbuf *buf) } fz_catch(ctx) { + int caught; + if (!csi->cookie) { fz_rethrow_if(ctx, FZ_ERROR_TRYLATER); } - else if (fz_caught(ctx) == FZ_ERROR_TRYLATER) + else if ((caught = fz_caught(ctx)) == FZ_ERROR_TRYLATER) { if (csi->cookie->incomplete_ok) csi->cookie->incomplete++; else fz_rethrow(ctx); } + else if (caught == FZ_ERROR_ABORT) + { + fz_rethrow(ctx); + } else { csi->cookie->errors++; @@ -524,6 +531,7 @@ pdf_process_contents_stream(pdf_csi *csi, pdf_obj *rdb, fz_stream *file) fz_catch(ctx) { fz_rethrow_if(ctx, FZ_ERROR_TRYLATER); + fz_rethrow_if(ctx, FZ_ERROR_ABORT); fz_warn(ctx, "Content stream parsing error - rendering truncated"); } } @@ -622,6 +630,7 @@ pdf_process_stream_object(pdf_document *doc, pdf_obj *obj, const pdf_process *pr } fz_catch(ctx) { + fz_rethrow_if(ctx, FZ_ERROR_ABORT); fz_rethrow_message(ctx, "cannot parse content stream"); } } @@ -643,6 +652,7 @@ pdf_process_glyph(pdf_document *doc, pdf_obj *resources, fz_buffer *contents, pd } fz_catch(ctx) { + fz_rethrow_if(ctx, FZ_ERROR_ABORT); fz_rethrow_message(ctx, "cannot parse glyph content stream"); } } |