summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-xref.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-06-27 18:22:47 +0100
committerRobin Watts <robin.watts@artifex.com>2013-06-27 18:53:27 +0100
commit260e54a956c54058051ce6ff31b36ad0ae1b60aa (patch)
tree42ec426873ee4daa184b5747cbcbffeb4179101e /source/pdf/pdf-xref.c
parente8dca3f6f8aa63c5fecca401c8292f74f3a61b6d (diff)
downloadmupdf-260e54a956c54058051ce6ff31b36ad0ae1b60aa.tar.xz
Bug 694382: Fix problems arising from recent pdf_obj changes.
Thanks to zeniko for spotting these problems. When we close a document, purge the glyph cache to ensure that no type3 glyphs hang around with pointers to pdf_obj's that are now gone. Pass doc to pdf_new_obj_from_str rather than NULL. We believe that the reason this needed to be NULL is no longer valid. Also, revert to using an int for ref counts. In a quick test of our regression suite we only found 2 files that ever made a refcount > 256 (and they never got larger than 768), but the potential is there for issues. Reverting to an int until we can think of a better idea.
Diffstat (limited to 'source/pdf/pdf-xref.c')
-rw-r--r--source/pdf/pdf-xref.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 1b693405..cc4a076b 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -1027,6 +1027,11 @@ pdf_close_document(pdf_document *doc)
return;
ctx = doc->ctx;
+ /* Type3 glyphs in the glyph cache can contain pdf_obj pointers
+ * that we are about to destroy. Simplest solution is to bin the
+ * glyph cache at this point. */
+ fz_purge_glyph_cache(ctx);
+
pdf_drop_js(doc->js);
pdf_free_xref_sections(doc);