diff options
author | Luigi Scarso <luigi.scarso@gmail.com> | 2019-03-17 21:43:59 +0000 |
---|---|---|
committer | Luigi Scarso <luigi.scarso@gmail.com> | 2019-03-17 21:43:59 +0000 |
commit | 5698059f8aa4109c8f98d166ef398f04c515b022 (patch) | |
tree | 63c2dc21e4bac555b03180757f787e931c9f1fa1 /Build/source/texk/web2c/luatexdir/image/pdftoepdf.c | |
parent | 92df70634c796daf81679360e2cc092d28cb6edc (diff) |
LuaTeX: several catches for indirect references to non existing objects.
git-svn-id: svn://tug.org/texlive/trunk@50430 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/image/pdftoepdf.c')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/image/pdftoepdf.c | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.c b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.c index 664bfef18c9..547d0f67cac 100644 --- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.c +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.c @@ -552,15 +552,23 @@ static void writeRefs(PDF pdf, PdfDocument * pdf_doc) ppref * ref ; ppxref * xref = ppdoc_xref (pdf_doc->pdfe); for (r = pdf_doc->inObjList; r != NULL;) { - ref = ppxref_find (xref, (ppuint) r->objnum); - obj = ppref_obj(ref); - if (obj->type == PPSTREAM) { - pdf_begin_obj(pdf, r->num, OBJSTM_NEVER); + if (xref != NULL) { + ref = ppxref_find(xref, (ppuint) r->objnum); + if (ref != NULL) { + obj = ppref_obj(ref); + if (obj->type == PPSTREAM) { + pdf_begin_obj(pdf, r->num, OBJSTM_NEVER); + } else { + pdf_begin_obj(pdf, r->num, 2); + } + copyObject(pdf, pdf_doc, obj); + pdf_end_obj(pdf); + } else { + formatted_warning("pdf inclusion","ignoring missing object %i, case 1\n",(int) r->objnum); + } } else { - pdf_begin_obj(pdf, r->num, 2); + formatted_warning("pdf inclusion","ignoring missing object %i, case 2\n",(int) r->objnum); } - copyObject(pdf, pdf_doc, obj); - pdf_end_obj(pdf); n = r->next; free(r); r = n; @@ -995,19 +1003,25 @@ int write_epdf_object(PDF pdf, image_dict * idict, int n) } else { PdfDocument * pdf_doc = refPdfDocument(img_filepath(idict), FE_FAIL, img_userpassword(idict), img_ownerpassword(idict)); ppdoc * pdfe = pdf_doc->pdfe; - ppref * ref = ppxref_find(ppdoc_xref(pdfe), (ppuint) n); - if (ref != NULL) { - ppobj *obj; - num = pdf->obj_count++; - obj = ppref_obj(ref); - if (obj->type == PPSTREAM) { - pdf_begin_obj(pdf, num, OBJSTM_NEVER); + if (ppdoc_xref(pdfe)) { + ppref * ref = ppxref_find(ppdoc_xref(pdfe), (ppuint) n); + if (ref != NULL) { + ppobj *obj; + num = pdf->obj_count++; + obj = ppref_obj(ref); + if (obj->type == PPSTREAM) { + pdf_begin_obj(pdf, num, OBJSTM_NEVER); + } else { + pdf_begin_obj(pdf, num, 2); + } + copyObject(pdf, pdf_doc, obj); + pdf_end_obj(pdf); + writeRefs(pdf, pdf_doc); } else { - pdf_begin_obj(pdf, num, 2); + formatted_warning("pdf inclusion","ignoring missing image %i, case 1\n",(int) n); } - copyObject(pdf, pdf_doc, obj); - pdf_end_obj(pdf); - writeRefs(pdf, pdf_doc); + } else { + formatted_warning("pdf inclusion","ignoring missing image %i, case 2\n",(int) n); } if (! img_keepopen(idict)) { unrefPdfDocument(img_filepath(idict)); |