aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFWriter.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-01-04 16:17:33 +0100
committerJay Berkenbilt <ejb@ql.org>2019-01-04 16:29:29 +0100
commita01359189b32c60c2d55b039f7aefd6c3ce0ebde (patch)
tree9f0f3041db8b4a160605c9e22aa4b2988ff2951f /libqpdf/QPDFWriter.cc
parent158156d5062a5ac335bcfde7893be4671affdc32 (diff)
downloadqpdf-a01359189b32c60c2d55b039f7aefd6c3ce0ebde.tar.zst
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.
Diffstat (limited to 'libqpdf/QPDFWriter.cc')
-rw-r--r--libqpdf/QPDFWriter.cc1
1 files changed, 1 insertions, 0 deletions
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<QPDFObjectHandle> queue;
queue.push_back(getTrimmedTrailer());
std::set<int> visited;