From 4a648b9a00d2c4de37bf17165b20a1fc32956eee Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 4 Nov 2021 12:11:48 -0400 Subject: Fix bug in merging resources /DR from foreign AcroForm (fixes #548) When making resources indirect in from_dr, the code was using the wrong owning QPDF, forgetting that from_dr had already been copied using CopyForeignObject. --- libqpdf/QPDFAcroFormDocumentHelper.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libqpdf/QPDFAcroFormDocumentHelper.cc') diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc index 256fa694..ad6efc70 100644 --- a/libqpdf/QPDFAcroFormDocumentHelper.cc +++ b/libqpdf/QPDFAcroFormDocumentHelper.cc @@ -1002,8 +1002,10 @@ QPDFAcroFormDocumentHelper::transformAnnotations( } // Merge the other document's /DR, creating a conflict // map. mergeResources checks to make sure both objects - // are dictionaries. - from_dr.makeResourcesIndirect(*from_qpdf); + // are dictionaries. By this point, if this is foreign, + // from_dr has been copied, so we use the target qpdf as + // the owning qpdf. + from_dr.makeResourcesIndirect(this->qpdf); dr.mergeResources(from_dr, &dr_map); if (from_afdh->getNeedAppearances()) -- cgit v1.2.3-54-g00ecf