Commit 25e11a444a25840e2b4635dbcb0197d5bb935d25

Authored by m-holger
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 66 getRoot().replaceKey("/Pages", pages);
67 67 }
68 68 seen.clear();
69   - if (pages.hasKey("/Kids")) {
  69 + if (!pages.hasKey("/Kids")) {
70 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 75 if (m->invalid_page_found) {
74 76 flattenPagesTree();
75 77 m->invalid_page_found = false;
... ...