aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-09-01 21:30:25 +0200
committerJay Berkenbilt <ejb@ql.org>2022-09-01 23:15:41 +0200
commit481b1aeb5008fcd742710ab1caa98def6c0dbf84 (patch)
tree19e134bf75490d84ea75d6fd1627c0fdc589ee19
parentf12539e8aa6500bbeba5721b6a121fff82b95fe6 (diff)
downloadqpdf-481b1aeb5008fcd742710ab1caa98def6c0dbf84.tar.zst
Add comments after merge of last pull request
-rw-r--r--libqpdf/QPDF_optimization.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc
index 91f2c385..1fe0b74f 100644
--- a/libqpdf/QPDF_optimization.cc
+++ b/libqpdf/QPDF_optimization.cc
@@ -142,7 +142,9 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys)
return;
}
- // Calling getAllPages() resolves any duplicated page objects.
+ // Calling getAllPages() resolves any duplicated page objects,
+ // repairs broken nodes, and detects loops, so we don't have to do
+ // those activities here.
getAllPages();
// key_ancestors is a mapping of page attribute keys to a stack of
@@ -234,7 +236,10 @@ QPDF::pushInheritedAttributesToPageInternal(
}
}
- // Process descendant nodes.
+ // Process descendant nodes. This method does not perform loop
+ // detection because all code paths that lead here follow a call
+ // to getAllPages, which already throws an exception in the event
+ // of a loop in the pages tree.
for (auto& kid: cur_pages.getKey("/Kids").aitems()) {
if (kid.isDictionaryOfType("/Pages")) {
pushInheritedAttributesToPageInternal(