From a01359189b32c60c2d55b039f7aefd6c3ce0ebde Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 4 Jan 2019 10:17:33 -0500 Subject: Fix dangling references (fixes #240) On certain operations, such as iterating through all objects and adding new indirect objects, walk through the entire object structure and explicitly resolve any indirect references to non-existent objects. That prevents new objects from springing into existence and causing the previously dangling references to point to them. --- libqpdf/QPDFWriter.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'libqpdf/QPDFWriter.cc') diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 71c48333..22b990ff 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -2244,6 +2244,7 @@ QPDFWriter::prepareFileForWrite() // includes stream lengths, stream filtering parameters, and // document extension level information. + this->m->pdf.fixDanglingReferences(true); std::list queue; queue.push_back(getTrimmedTrailer()); std::set visited; -- cgit v1.2.3-54-g00ecf