aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r--libqpdf/QPDF.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index b5c1212c..4d5bf67f 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -2028,7 +2028,14 @@ QPDF::getTrailer()
QPDFObjectHandle
QPDF::getRoot()
{
- return this->trailer.getKey("/Root");
+ QPDFObjectHandle root = this->trailer.getKey("/Root");
+ if (! root.isDictionary())
+ {
+ throw QPDFExc(qpdf_e_damaged_pdf, file->getName(),
+ "", file->getLastOffset(),
+ "unable to find /Root dictionary");
+ }
+ return root;
}
void