diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-01-31 13:46:13 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-01-31 13:49:08 +0100 |
commit | 178f995fc2d0dd0be4ea3ba676cbcc8ffd22f29b (patch) | |
tree | 29c7233b847c0a297844236d3f41e10e7c0cd581 /libqpdf | |
parent | 4ae93a73c5bbf36cf2b36712b0df7acabbc1e61a (diff) | |
download | qpdf-178f995fc2d0dd0be4ea3ba676cbcc8ffd22f29b.tar.zst |
Recover from exceptions during filtering for inline images
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFPageObjectHelper.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc index 07700a66..298da481 100644 --- a/libqpdf/QPDFPageObjectHelper.cc +++ b/libqpdf/QPDFPageObjectHelper.cc @@ -501,8 +501,20 @@ QPDFPageObjectHelper::externalizeInlineImages(size_t min_size, bool shallow) QPDFObjectHandle::parse("<< /XObject << >> >>")); InlineImageTracker iit(this->oh.getOwningQPDF(), min_size, resources); Pl_Buffer b("new page content"); - filterContents(&iit, &b); - if (iit.any_images) + bool filtered = false; + try + { + filterContents(&iit, &b); + filtered = true; + } + catch (std::exception& e) + { + this->oh.warnIfPossible( + std::string("Unable to filter content stream: ") + e.what() + + "; not attempting to externalize inline images" + " from this stream"); + } + if (filtered && iit.any_images) { if (this->oh.isFormXObject()) { |