diff options
author | Robin Watts <robin.watts@artifex.com> | 2015-09-30 19:10:45 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-10-01 11:11:10 +0100 |
commit | 841398e7693a511df66dd0f1b33d9604371d53e0 (patch) | |
tree | 9543c6591a5fd856da2b2c52d6c7ed970a697ca8 /source/pdf/pdf-xref.c | |
parent | e6a6cccd2295ad09fc569debda49ebcef8b2cd92 (diff) | |
download | mupdf-841398e7693a511df66dd0f1b33d9604371d53e0.tar.xz |
Bug 696146: Improve pdf_repair to find /Root in new style XRefs.
The current code never looks for /Root objects in dictionaries
as it parses them. This means that 'New style' files end up
without any Roots after repair.
The new code therefore updates pdf_repair_obj to look for Root
objects in the same way it looks for encrypt and id objects.
These go into the list of found roots.
The Root object almost certainly has indirections within it, so
it is vital that the 'doc' pointer gets set. This means we have
to make a slight adjustment to pdf_repair_obj so that the dict
is parsed with a doc pointer. In turn this means we need to
manually ensure that none of the other information read from
the dict during the repair operation will cause indirections
to be resolved. This is achieved by checking for
!pdf_is_indirect at various points.
Diffstat (limited to 'source/pdf/pdf-xref.c')
-rw-r--r-- | source/pdf/pdf-xref.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index 3a9f70df..727dcda7 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -1807,7 +1807,7 @@ pdf_obj_read(fz_context *ctx, pdf_document *doc, fz_off_t *offset, int *nump, pd * whenever we read an object it should just go into the * previous xref. */ - tok = pdf_repair_obj(ctx, doc, buf, &stmofs, NULL, NULL, NULL, page, &newtmpofs); + tok = pdf_repair_obj(ctx, doc, buf, &stmofs, NULL, NULL, NULL, page, &newtmpofs, NULL); do /* So we can break out of it */ { @@ -2600,7 +2600,7 @@ pdf_load_hint_object(fz_context *ctx, pdf_document *doc) tok = pdf_lex(ctx, doc->file, buf); if (tok != PDF_TOK_OBJ) break; - (void)pdf_repair_obj(ctx, doc, buf, &tmpofs, NULL, NULL, NULL, &page, &tmpofs); + (void)pdf_repair_obj(ctx, doc, buf, &tmpofs, NULL, NULL, NULL, &page, &tmpofs, NULL); pdf_load_hints(ctx, doc, num, gen); } } |