From 9c2c5644c77761b7a065ebdcbbb63b88b182c94b Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Tue, 28 Jul 2015 14:30:52 +0200 Subject: 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(). --- source/pdf/pdf-xref.c | 4 ++++ 1 file changed, 4 insertions(+) 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); } -- cgit v1.2.3