summaryrefslogtreecommitdiff
path: root/pdf/pdf_xref.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-15 19:49:16 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-15 19:49:16 +0000
commite6118ac1b13cc49f637861fccbc32a10c4ea1ea7 (patch)
tree4ccb1fb5adf96d7794872502ee975825f250054a /pdf/pdf_xref.c
parent3031a2480fe775df825de6674495d01ae2607d93 (diff)
downloadmupdf-e6118ac1b13cc49f637861fccbc32a10c4ea1ea7.tar.xz
Various Memsqueezing fixes.
Fixes for leaks (and SEGVs, division by zeros etc) seen when Memsqueezing.
Diffstat (limited to 'pdf/pdf_xref.c')
-rw-r--r--pdf/pdf_xref.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c
index b560d868..d47524b6 100644
--- a/pdf/pdf_xref.c
+++ b/pdf/pdf_xref.c
@@ -676,7 +676,6 @@ pdf_open_xref_with_stream(fz_stream *file, char *password)
xref->trailer = NULL;
}
fz_warn(xref->ctx, "trying to repair broken xref");
- pdf_repair_xref(xref, xref->scratch, sizeof xref->scratch);
repaired = 1;
}
@@ -684,6 +683,9 @@ pdf_open_xref_with_stream(fz_stream *file, char *password)
{
int hasroot, hasinfo;
+ if (repaired)
+ pdf_repair_xref(xref, xref->scratch, sizeof xref->scratch);
+
encrypt = fz_dict_gets(xref->trailer, "Encrypt");
id = fz_dict_gets(xref->trailer, "ID");
if (fz_is_dict(encrypt))