diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-12-01 17:15:27 -0500 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-12-14 16:31:13 +0100 |
commit | 2590fed7a355a421f062ebd4293df892800fa7ac (patch) | |
tree | 7a07c95024c28a7e1ac0506e6ffbf06c9f259e37 /source | |
parent | ffc4b61e6baf7a4d4e34c8901ae78ffd57da2530 (diff) | |
download | mupdf-2590fed7a355a421f062ebd4293df892800fa7ac.tar.xz |
Bug 697400: Mark visited objects when counting OCG layer entries.
Diffstat (limited to 'source')
-rw-r--r-- | source/pdf/pdf-layer.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/pdf/pdf-layer.c b/source/pdf/pdf-layer.c index 3296b6c5..fc29c9d3 100644 --- a/source/pdf/pdf-layer.c +++ b/source/pdf/pdf-layer.c @@ -90,7 +90,14 @@ count_entries(fz_context *ctx, pdf_obj *obj) for (i = 0; i < len; i++) { pdf_obj *o = pdf_array_get(ctx, obj, i); - count += (pdf_is_array(ctx, o) ? count_entries(ctx, o) : 1); + if (pdf_mark_obj(ctx, o)) + continue; + fz_try(ctx) + count += (pdf_is_array(ctx, o) ? count_entries(ctx, o) : 1); + fz_always(ctx) + pdf_unmark_obj(ctx, o); + fz_catch(ctx) + fz_rethrow(ctx); } return count; } @@ -106,7 +113,16 @@ populate_ui(fz_context *ctx, pdf_ocg_descriptor *desc, pdf_ocg_ui *ui, pdf_obj * pdf_obj *o = pdf_array_get(ctx, order, i); if (pdf_is_array(ctx, o)) { - ui = populate_ui(ctx, desc, ui, o, depth+1, rbgroups, locked); + if (pdf_mark_obj(ctx, o)) + continue; + + fz_try(ctx) + ui = populate_ui(ctx, desc, ui, o, depth+1, rbgroups, locked); + fz_always(ctx) + pdf_unmark_obj(ctx, o); + fz_catch(ctx) + fz_rethrow(ctx); + continue; } ui->depth = depth; |