Commit 178f995fc2d0dd0be4ea3ba676cbcc8ffd22f29b
1 parent
4ae93a73
Recover from exceptions during filtering for inline images
Showing
1 changed file
with
14 additions
and
2 deletions
libqpdf/QPDFPageObjectHelper.cc
| ... | ... | @@ -501,8 +501,20 @@ QPDFPageObjectHelper::externalizeInlineImages(size_t min_size, bool shallow) |
| 501 | 501 | QPDFObjectHandle::parse("<< /XObject << >> >>")); |
| 502 | 502 | InlineImageTracker iit(this->oh.getOwningQPDF(), min_size, resources); |
| 503 | 503 | Pl_Buffer b("new page content"); |
| 504 | - filterContents(&iit, &b); | |
| 505 | - if (iit.any_images) | |
| 504 | + bool filtered = false; | |
| 505 | + try | |
| 506 | + { | |
| 507 | + filterContents(&iit, &b); | |
| 508 | + filtered = true; | |
| 509 | + } | |
| 510 | + catch (std::exception& e) | |
| 511 | + { | |
| 512 | + this->oh.warnIfPossible( | |
| 513 | + std::string("Unable to filter content stream: ") + e.what() + | |
| 514 | + "; not attempting to externalize inline images" | |
| 515 | + " from this stream"); | |
| 516 | + } | |
| 517 | + if (filtered && iit.any_images) | |
| 506 | 518 | { |
| 507 | 519 | if (this->oh.isFormXObject()) |
| 508 | 520 | { | ... | ... |