Commit 25e11a444a25840e2b4635dbcb0197d5bb935d25
1 parent
7f2d76b7
Throw an exception if the root of the pages tree misses the /Kids array
Showing
1 changed file
with
4 additions
and
2 deletions
libqpdf/QPDF_pages.cc
| @@ -66,10 +66,12 @@ QPDF::getAllPages() | @@ -66,10 +66,12 @@ QPDF::getAllPages() | ||
| 66 | getRoot().replaceKey("/Pages", pages); | 66 | getRoot().replaceKey("/Pages", pages); |
| 67 | } | 67 | } |
| 68 | seen.clear(); | 68 | seen.clear(); |
| 69 | - if (pages.hasKey("/Kids")) { | 69 | + if (!pages.hasKey("/Kids")) { |
| 70 | // Ensure we actually found a /Pages object. | 70 | // Ensure we actually found a /Pages object. |
| 71 | - getAllPagesInternal(pages, visited, seen, false); | 71 | + throw QPDFExc( |
| 72 | + qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array"); | ||
| 72 | } | 73 | } |
| 74 | + getAllPagesInternal(pages, visited, seen, false); | ||
| 73 | if (m->invalid_page_found) { | 75 | if (m->invalid_page_found) { |
| 74 | flattenPagesTree(); | 76 | flattenPagesTree(); |
| 75 | m->invalid_page_found = false; | 77 | m->invalid_page_found = false; |