diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-01-04 17:50:02 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-01-04 17:55:42 +0100 |
commit | 837dcf8fc2546a80f205a0c4c53e5a1545c53a84 (patch) | |
tree | 8c21738d5bb958faadb36ffdaff3f4dbc82cbb35 /libqpdf/QPDF.cc | |
parent | a01359189b32c60c2d55b039f7aefd6c3ce0ebde (diff) | |
download | qpdf-837dcf8fc2546a80f205a0c4c53e5a1545c53a84.tar.zst |
Don't call assert while checking linearization data (fixes #209, #231)
Instead of calling assert for problems found during checking
linearization data, throw an exception which is later caught and
issued as an error. Ideally we would handle errors more robustly, but
this is still a significant improvement.
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r-- | libqpdf/QPDF.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index caea6424..84697f2b 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -2609,3 +2609,13 @@ QPDF::findAttachmentStreams() } } } + +void +QPDF::stopOnError(std::string const& message) +{ + // Throw a generic exception when we lack context for something + // more specific. New code should not use this. This method exists + // to improve somewhat from calling assert in very old code. + throw QPDFExc(qpdf_e_damaged_pdf, this->m->file->getName(), + "", this->m->file->getLastOffset(), message); +} |