2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-09-16 15:19:07 +00:00

Throw an exception if the root of the pages tree misses the /Kids array

This commit is contained in:
m-holger 2024-07-16 14:44:47 +01:00
parent 7f2d76b78d
commit 25e11a444a

View File

@ -66,10 +66,12 @@ QPDF::getAllPages()
getRoot().replaceKey("/Pages", pages);
}
seen.clear();
if (pages.hasKey("/Kids")) {
if (!pages.hasKey("/Kids")) {
// Ensure we actually found a /Pages object.
getAllPagesInternal(pages, visited, seen, false);
throw QPDFExc(
qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
}
getAllPagesInternal(pages, visited, seen, false);
if (m->invalid_page_found) {
flattenPagesTree();
m->invalid_page_found = false;