summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2015-07-28 14:30:52 +0200
committerSebastian Rasmussen <sebras@gmail.com>2015-07-28 14:42:40 +0200
commit9c2c5644c77761b7a065ebdcbbb63b88b182c94b (patch)
tree85b71dd945d0cea9b3324a9a3604bada9283b774
parentfd54bf89f2adfd5545202a6df87076fb7269f62c (diff)
downloadmupdf-9c2c5644c77761b7a065ebdcbbb63b88b182c94b.tar.xz
Reset xref object entry when repairing pdf objects.
When attempting to load pdf objects and a valid pdf object is found but it has the wrong number, mark the xref object entry as being free before attempting to repair the xref. This ensures that if the wanted object cannot be found in the document then the missing object will be considered to be null. Previously it was still assumed to be around, but the object pointer was NULL triggering an assert in pdf_load_object().
-rw-r--r--source/pdf/pdf-xref.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 2341ddd9..a5cc29ef 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -1936,6 +1936,10 @@ object_updated:
if (!try_repair && rnum != num)
{
pdf_drop_obj(ctx, x->obj);
+ x->type = 'f';
+ x->ofs = -1;
+ x->gen = 0;
+ x->stm_ofs = 0;
x->obj = NULL;
try_repair = (doc->repair_attempted == 0);
}