Commit 481b1aeb5008fcd742710ab1caa98def6c0dbf84
1 parent
f12539e8
Add comments after merge of last pull request
Showing
1 changed file
with
7 additions
and
2 deletions
libqpdf/QPDF_optimization.cc
| ... | ... | @@ -142,7 +142,9 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys) |
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - // Calling getAllPages() resolves any duplicated page objects. | |
| 145 | + // Calling getAllPages() resolves any duplicated page objects, | |
| 146 | + // repairs broken nodes, and detects loops, so we don't have to do | |
| 147 | + // those activities here. | |
| 146 | 148 | getAllPages(); |
| 147 | 149 | |
| 148 | 150 | // key_ancestors is a mapping of page attribute keys to a stack of |
| ... | ... | @@ -234,7 +236,10 @@ QPDF::pushInheritedAttributesToPageInternal( |
| 234 | 236 | } |
| 235 | 237 | } |
| 236 | 238 | |
| 237 | - // Process descendant nodes. | |
| 239 | + // Process descendant nodes. This method does not perform loop | |
| 240 | + // detection because all code paths that lead here follow a call | |
| 241 | + // to getAllPages, which already throws an exception in the event | |
| 242 | + // of a loop in the pages tree. | |
| 238 | 243 | for (auto& kid: cur_pages.getKey("/Kids").aitems()) { |
| 239 | 244 | if (kid.isDictionaryOfType("/Pages")) { |
| 240 | 245 | pushInheritedAttributesToPageInternal( | ... | ... |