aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2023-10-07 19:29:10 +0200
committerJay Berkenbilt <ejb@ql.org>2023-10-07 19:29:10 +0200
commit98014ec98a0175d6853ac5fe0ee420913fb78d16 (patch)
treefa0374985e2a05d44e13d16523d9fd3b272e32e8 /libqpdf/QPDF.cc
parentb075de73c88db1a315dc0542d4378ec5a2788255 (diff)
downloadqpdf-98014ec98a0175d6853ac5fe0ee420913fb78d16.tar.zst
Fix error with stream recovery (fixes #1042)
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r--libqpdf/QPDF.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index bd591a51..473cf5f0 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -2418,6 +2418,7 @@ QPDF::pipeStreamData(
decryptStream(encp, file, qpdf_for_warning, pipeline, og, stream_dict, to_delete);
}
+ bool attempted_finish = false;
bool success = false;
try {
file->seek(offset, SEEK_SET);
@@ -2432,6 +2433,7 @@ QPDF::pipeStreamData(
length -= len;
pipeline->write(buf, len);
}
+ attempted_finish = true;
pipeline->finish();
success = true;
} catch (QPDFExc& e) {
@@ -2461,7 +2463,7 @@ QPDF::pipeStreamData(
}
}
}
- if (!success) {
+ if (!attempted_finish) {
try {
pipeline->finish();
} catch (std::exception&) {