aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2017-07-30 01:31:12 +0200
committerJay Berkenbilt <ejb@ql.org>2017-07-30 01:31:12 +0200
commit570db9b60b64b91d875f1b838826a7b2e21079b4 (patch)
treece7a98453bbd2e7797625187c41b85b407371ca4 /libqpdf
parentb43a0ac2371b47c9bf73497a8b4853712dfdf3b8 (diff)
downloadqpdf-570db9b60b64b91d875f1b838826a7b2e21079b4.tar.zst
Catch more exceptions while resolving objects
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDF.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index a5f956b8..cfadaa3a 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -1542,6 +1542,7 @@ QPDF::resolve(int objid, int generation)
}
QPDFXRefEntry const& entry = this->xref_table[og];
+ bool success = false;
try
{
switch (entry.getType())
@@ -1569,11 +1570,23 @@ QPDF::resolve(int objid, int generation)
QUtil::int_to_string(generation) +
" has unexpected xref entry type");
}
+ success = true;
}
catch (QPDFExc& e)
{
- QTC::TC("qpdf", "QPDF resolve failure to null");
warn(e);
+ }
+ catch (std::exception& e)
+ {
+ warn(QPDFExc(qpdf_e_damaged_pdf, this->file->getName(), "", 0,
+ "object " +
+ QUtil::int_to_string(objid) + "/" +
+ QUtil::int_to_string(generation) +
+ ": error reading object: " + e.what()));
+ }
+ if (! success)
+ {
+ QTC::TC("qpdf", "QPDF resolve failure to null");
QPDFObjectHandle oh = QPDFObjectHandle::newNull();
this->obj_cache[og] =
ObjCache(QPDFObjectHandle::ObjAccessor::getObject(oh), -1, -1);