diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-01-06 11:38:43 +0000 |
---|---|---|
committer | Robin Watts <robin@ghostscript.com> | 2012-01-06 13:49:24 +0000 |
commit | 09f1a3d3d863099c103100ed10c8cec82ea7aed3 (patch) | |
tree | e5eaa31b5b2efc0c9e9537649e7e681ed428e8c0 /fitz/fitz.h | |
parent | a0203aeba59a207db78a312b9b3aacf97b2802f5 (diff) | |
download | mupdf-09f1a3d3d863099c103100ed10c8cec82ea7aed3.tar.xz |
Add 'marking' functions for dictionaries.
In various places in the code, we add markers (".seen") to
dictionaries as we traverse them to ensure that we don't
go into infinite loops.
Adding a dictionary entry is bad as it's a) an expensive
operation, b) a potentially destructive one, and c) produces another
possible point of failure (as mallocs can fail).
Instead, add a flag to each dict to allow them to be marked/unmarked
and use that instead.
Thanks to Zeniko for pointing out various places that could usefully
be protected against infinite recursion.
Diffstat (limited to 'fitz/fitz.h')
-rw-r--r-- | fitz/fitz.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h index 61e59fa4..fe0e4d6b 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -438,6 +438,11 @@ int fz_is_indirect(fz_obj *obj); int fz_objcmp(fz_obj *a, fz_obj *b); +/* dict marking and unmarking functions - to avoid infinite recursions */ +int fz_dict_marked(fz_obj *obj); +int fz_dict_mark(fz_obj *obj); +void fz_dict_unmark(fz_obj *obj); + /* safe, silent failure, no error reporting on type mismatches */ int fz_to_bool(fz_obj *obj); int fz_to_int(fz_obj *obj); |