aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFAcroFormDocumentHelper.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-11-04 17:11:48 +0100
committerJay Berkenbilt <ejb@ql.org>2021-11-04 17:29:42 +0100
commit4a648b9a00d2c4de37bf17165b20a1fc32956eee (patch)
treeb5e774eaf4374dd1973b8a2d7cd9a837d53812ab /libqpdf/QPDFAcroFormDocumentHelper.cc
parent9b28933647f0a3ed535dd488c4526b75d1c10fc6 (diff)
downloadqpdf-4a648b9a00d2c4de37bf17165b20a1fc32956eee.tar.zst
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.
Diffstat (limited to 'libqpdf/QPDFAcroFormDocumentHelper.cc')
-rw-r--r--libqpdf/QPDFAcroFormDocumentHelper.cc6
1 files changed, 4 insertions, 2 deletions
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())