diff options
author | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2023-03-20 11:59:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-20 11:59:47 +0100 |
commit | f89196b6c898ac8fa7ce3fb477d0c4b03d0ece4f (patch) | |
tree | f5f20a8116d8e9869563ede4c109cff772c164eb /libqpdf/QPDF.cc | |
parent | 96520d2583e014c1ecc6cede83610070a1a5608a (diff) | |
parent | d8acccd5c8fff308a0010f787eedc594fa3e5ee9 (diff) | |
download | qpdf-f89196b6c898ac8fa7ce3fb477d0c4b03d0ece4f.tar.zst |
Merge pull request #814 from m-holger/check
Warn if catalog type entry is invalid (fixes #810)
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r-- | libqpdf/QPDF.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 69508b08..c6f6ae6e 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -2461,6 +2461,13 @@ QPDF::getRoot() QPDFObjectHandle root = this->m->trailer.getKey("/Root"); if (!root.isDictionary()) { throw damagedPDF("", 0, "unable to find /Root dictionary"); + } else if ( + // Check_mode is an interim solution to request #810 pending a more + // comprehensive review of the approach to more extensive checks and + // warning levels. + m->check_mode && !root.getKey("/Type").isNameAndEquals("/Catalog")) { + warn(damagedPDF("", 0, "catalog /Type entry missing or invalid")); + root.replaceKey("/Type", "/Catalog"_qpdf); } return root; } |