diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-11-21 11:20:22 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-11-21 11:21:11 +0100 |
commit | 34731835e4fb29d7b44252f5cb610b0d4561d1c5 (patch) | |
tree | a175e8800029c064c2dcd2a272ec49b5deba96d1 | |
parent | bff572a7365209f36a16951296384974c80ad3d5 (diff) | |
download | mupdf-34731835e4fb29d7b44252f5cb610b0d4561d1c5.tar.xz |
Fix a few cases where pdf_unmark_obj wasn't always being called on errors.
-rw-r--r-- | source/pdf/pdf-nametree.c | 22 | ||||
-rw-r--r-- | source/pdf/pdf-op-run.c | 8 |
2 files changed, 20 insertions, 10 deletions
diff --git a/source/pdf/pdf-nametree.c b/source/pdf/pdf-nametree.c index a3b7acb0..178f1cea 100644 --- a/source/pdf/pdf-nametree.c +++ b/source/pdf/pdf-nametree.c @@ -29,8 +29,12 @@ pdf_lookup_name_imp(fz_context *ctx, pdf_obj *node, pdf_obj *needle) if (pdf_mark_obj(ctx, node)) break; - obj = pdf_lookup_name_imp(ctx, kid, needle); - pdf_unmark_obj(ctx, node); + fz_try(ctx) + obj = pdf_lookup_name_imp(ctx, kid, needle); + fz_always(ctx) + pdf_unmark_obj(ctx, node); + fz_catch(ctx) + fz_rethrow(ctx); return obj; } } @@ -114,10 +118,16 @@ pdf_load_name_tree_imp(fz_context *ctx, pdf_obj *dict, pdf_document *doc, pdf_ob if (kids && !pdf_mark_obj(ctx, node)) { - int len = pdf_array_len(ctx, kids); - for (i = 0; i < len; i++) - pdf_load_name_tree_imp(ctx, dict, doc, pdf_array_get(ctx, kids, i)); - pdf_unmark_obj(ctx, node); + fz_try(ctx) + { + int len = pdf_array_len(ctx, kids); + for (i = 0; i < len; i++) + pdf_load_name_tree_imp(ctx, dict, doc, pdf_array_get(ctx, kids, i)); + } + fz_always(ctx) + pdf_unmark_obj(ctx, node); + fz_catch(ctx) + fz_rethrow(ctx); } if (names) diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index 00d1957d..29031657 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -1230,10 +1230,6 @@ pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_xobject *xobj, pdf if (xobj == NULL || pdf_mark_obj(ctx, xobj->obj)) return; - pdf_xobject_bbox(ctx, xobj, &xobj_bbox); - pdf_xobject_matrix(ctx, xobj, &xobj_matrix); - transparency = pdf_xobject_transparency(ctx, xobj); - fz_var(cleanup_state); fz_var(gstate); fz_var(oldtop); @@ -1248,6 +1244,10 @@ pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_xobject *xobj, pdf gstate = pr->gstate + pr->gtop; oldtop = pr->gtop; + pdf_xobject_bbox(ctx, xobj, &xobj_bbox); + pdf_xobject_matrix(ctx, xobj, &xobj_matrix); + transparency = pdf_xobject_transparency(ctx, xobj); + /* apply xobject's transform matrix */ fz_concat(&local_transform, &xobj_matrix, &local_transform); fz_concat(&gstate->ctm, &local_transform, &gstate->ctm); |