summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-page.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-07-12 16:11:03 +0200
committerTor Andersson <tor.andersson@artifex.com>2013-07-12 16:11:03 +0200
commitbc8b6cc1e73686a97a3b2ea3160ec851c850d3f1 (patch)
treef0f5cdd65fa64af6e4b9c2d8f7ec9c7192579719 /source/pdf/pdf-page.c
parentee8434b9ab301f7f936f5766c41592df6888785d (diff)
downloadmupdf-bc8b6cc1e73686a97a3b2ea3160ec851c850d3f1.tar.xz
Throw exception on invalid page objects when looking up page numbers.
Also handle exceptions when parsing link destinations.
Diffstat (limited to 'source/pdf/pdf-page.c')
-rw-r--r--source/pdf/pdf-page.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c
index 9f802927..66e72bc7 100644
--- a/source/pdf/pdf-page.c
+++ b/source/pdf/pdf-page.c
@@ -129,11 +129,14 @@ pdf_lookup_page_number(pdf_document *doc, pdf_obj *node)
int total = 0;
pdf_obj *parent, *parent2;
+ if (strcmp(pdf_to_name(pdf_dict_gets(node, "Type")), "Page") != 0)
+ fz_throw(ctx, FZ_ERROR_GENERIC, "invalid page object");
+
parent2 = parent = pdf_dict_gets(node, "Parent");
fz_var(parent);
fz_try(ctx)
{
- while (parent)
+ while (pdf_is_dict(parent))
{
if (pdf_mark_obj(parent))
fz_throw(ctx, FZ_ERROR_GENERIC, "cycle in page tree (parents)");