summaryrefslogtreecommitdiff
path: root/pdf/pdf_cmap_load.c
diff options
context:
space:
mode:
Diffstat (limited to 'pdf/pdf_cmap_load.c')
-rw-r--r--pdf/pdf_cmap_load.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pdf/pdf_cmap_load.c b/pdf/pdf_cmap_load.c
index 8ab7e646..36ca202b 100644
--- a/pdf/pdf_cmap_load.c
+++ b/pdf/pdf_cmap_load.c
@@ -31,6 +31,9 @@ pdf_load_embedded_cmap(pdf_document *xref, pdf_obj *stmobj)
fz_var(file);
fz_var(cmap);
+ if (pdf_obj_marked(stmobj))
+ fz_throw(ctx, "Recursion in embedded cmap");
+
if ((cmap = pdf_find_item(ctx, pdf_free_cmap_imp, stmobj)))
{
return cmap;
@@ -58,7 +61,10 @@ pdf_load_embedded_cmap(pdf_document *xref, pdf_obj *stmobj)
else if (pdf_is_indirect(obj))
{
phase = 3;
+ pdf_obj_mark(obj);
usecmap = pdf_load_embedded_cmap(xref, obj);
+ pdf_obj_unmark(obj);
+ phase = 4;
pdf_set_usecmap(ctx, cmap, usecmap);
pdf_drop_cmap(ctx, usecmap);
}
@@ -78,7 +84,11 @@ pdf_load_embedded_cmap(pdf_document *xref, pdf_obj *stmobj)
else if (phase < 3)
fz_throw(ctx, "cannot load system usecmap '%s'", pdf_to_name(obj));
else
+ {
+ if (phase == 3)
+ pdf_obj_unmark(obj);
fz_throw(ctx, "cannot load embedded usecmap (%d %d R)", pdf_to_num(obj), pdf_to_gen(obj));
+ }
}
return cmap;