diff options
author | Jay Berkenbilt <ejb@ql.org> | 2023-01-09 13:31:39 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2023-01-09 13:31:39 +0100 |
commit | e4e0f40fc0b9fe74865898b640ff82f84996bb5d (patch) | |
tree | 2cf9ff020152d238d523ca9288e329305a9d4acf /libqpdf/QPDFPageDocumentHelper.cc | |
parent | 126b0269379bbb6cc6c8b808d34b216539682a75 (diff) | |
download | qpdf-e4e0f40fc0b9fe74865898b640ff82f84996bb5d.tar.zst |
Fix annotations properly for page with no /Resources (fixes #827)
Diffstat (limited to 'libqpdf/QPDFPageDocumentHelper.cc')
-rw-r--r-- | libqpdf/QPDFPageDocumentHelper.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libqpdf/QPDFPageDocumentHelper.cc b/libqpdf/QPDFPageDocumentHelper.cc index 39b2800a..31d84e4b 100644 --- a/libqpdf/QPDFPageDocumentHelper.cc +++ b/libqpdf/QPDFPageDocumentHelper.cc @@ -67,9 +67,11 @@ QPDFPageDocumentHelper::flattenAnnotations( for (auto& ph: getAllPages()) { QPDFObjectHandle resources = ph.getAttribute("/Resources", true); if (!resources.isDictionary()) { - // This should never happen and is not exercised in the - // test suite - resources = QPDFObjectHandle::newDictionary(); + QTC::TC( + "qpdf", + "QPDFPageDocumentHelper flatten resources missing or invalid"); + resources = ph.getObjectHandle().replaceKeyAndGetNew( + "/Resources", QPDFObjectHandle::newDictionary()); } flattenAnnotationsForPage( ph, resources, afdh, required_flags, forbidden_flags); |