diff options
Diffstat (limited to 'libqpdf/QPDFWriter.cc')
-rw-r--r-- | libqpdf/QPDFWriter.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index a7c78b19..ce5cb3e0 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -761,6 +761,15 @@ QPDFWriter::enqueueObject(QPDFObjectHandle object) { if (object.isIndirect()) { + if (object.getOwningQPDF() != &(this->pdf)) + { + QTC::TC("qpdf", "QPDFWriter foreign object"); + throw std::logic_error( + "QPDFObjectHandle from different QPDF found while writing." + " Use QPDF::copyForeignObject to add objects from" + " another file."); + } + if (object.isNull()) { // This is a place-holder object for an object stream |