summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-annot.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-11-18 13:02:01 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-11-21 11:11:46 +0100
commitbff572a7365209f36a16951296384974c80ad3d5 (patch)
tree7d63479831c8edc24bc5933a1ef61c376a8dd6b2 /source/pdf/pdf-annot.c
parentac6ebbe38e6edb6074b1b73707770a9a4e9979b8 (diff)
downloadmupdf-bff572a7365209f36a16951296384974c80ad3d5.tar.xz
Harden viewers against failures when loading outlines.
Ignore invalid page references in outlines. This was shown by a file that had [null 0 0 1] as a link dest. Attempting to parse that threw an error, which caused the whole outline load to fail.
Diffstat (limited to 'source/pdf/pdf-annot.c')
-rw-r--r--source/pdf/pdf-annot.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c
index 2d6aab16..6f622da4 100644
--- a/source/pdf/pdf-annot.c
+++ b/source/pdf/pdf-annot.c
@@ -67,7 +67,12 @@ pdf_parse_link_dest(fz_context *ctx, pdf_document *doc, pdf_obj *dest)
if (pdf_is_int(ctx, obj))
page = pdf_to_int(ctx, obj);
else
- page = pdf_lookup_page_number(ctx, doc, obj);
+ {
+ fz_try(ctx)
+ page = pdf_lookup_page_number(ctx, doc, obj);
+ fz_catch(ctx)
+ page = -1;
+ }
x = y = 0;
obj = pdf_array_get(ctx, dest, 1);