diff options
author | Jay Berkenbilt <ejb@ql.org> | 2012-07-14 14:07:23 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2012-07-14 14:07:23 +0200 |
commit | 1c944e4c89cf09d86f4e3f79ff57d937dab9b60f (patch) | |
tree | cee2396523e428bf0dcb3e2f3ed2b252d7530081 /libqpdf/QPDFWriter.cc | |
parent | 11b194a1d0b02e5964359510ab4e914c16c0c50c (diff) | |
download | qpdf-1c944e4c89cf09d86f4e3f79ff57d937dab9b60f.tar.zst |
Have QPDFWriter detect foreign objects while writing
Throw an exception that directs the user to QPDF::copyForeignObject.
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 |