mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-03 15:17:29 +00:00
Catch more exceptions while resolving objects
This commit is contained in:
parent
b43a0ac237
commit
570db9b60b
@ -1542,6 +1542,7 @@ QPDF::resolve(int objid, int generation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QPDFXRefEntry const& entry = this->xref_table[og];
|
QPDFXRefEntry const& entry = this->xref_table[og];
|
||||||
|
bool success = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch (entry.getType())
|
switch (entry.getType())
|
||||||
@ -1569,11 +1570,23 @@ QPDF::resolve(int objid, int generation)
|
|||||||
QUtil::int_to_string(generation) +
|
QUtil::int_to_string(generation) +
|
||||||
" has unexpected xref entry type");
|
" has unexpected xref entry type");
|
||||||
}
|
}
|
||||||
|
success = true;
|
||||||
}
|
}
|
||||||
catch (QPDFExc& e)
|
catch (QPDFExc& e)
|
||||||
{
|
{
|
||||||
QTC::TC("qpdf", "QPDF resolve failure to null");
|
|
||||||
warn(e);
|
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();
|
QPDFObjectHandle oh = QPDFObjectHandle::newNull();
|
||||||
this->obj_cache[og] =
|
this->obj_cache[og] =
|
||||||
ObjCache(QPDFObjectHandle::ObjAccessor::getObject(oh), -1, -1);
|
ObjCache(QPDFObjectHandle::ObjAccessor::getObject(oh), -1, -1);
|
||||||
|
Loading…
Reference in New Issue
Block a user