2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

Fix error with stream recovery (fixes #1042)

This commit is contained in:
Jay Berkenbilt 2023-10-07 13:29:10 -04:00
parent b075de73c8
commit 98014ec98a
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2023-10-07 Jay Berkenbilt <ejb@ql.org>
* Bug fix: when piping stream data, don't call finish on failure
if the failure was caused by a previous call to finish. Fixes
#1042.
2023-09-05 Jay Berkenbilt <ejb@ql.org>
* 11.6.1: release

View File

@ -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&) {