diff options
author | Jay Berkenbilt <ejb@ql.org> | 2018-08-05 21:42:01 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2018-08-05 21:43:34 +0200 |
commit | e1cd5891af199dc6d926a1792c9add182b39fc56 (patch) | |
tree | ecd28806fec54a353924d9681bd8fa6670d6abc5 /libqpdf | |
parent | 651b51f0564d7726df09faf6ac0a0dd36e4fa65a (diff) | |
download | qpdf-e1cd5891af199dc6d926a1792c9add182b39fc56.tar.zst |
Fix infinite loop on small files with progress reporting (fixes #230)
Turns out you can keep adding zero to a number over and over again and
it just doesn't get any bigger. Who would have known?
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFWriter.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 447b6627..30ba6f1f 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -3357,9 +3357,10 @@ QPDFWriter::indicateProgress(bool decrement, bool finished) this->m->events_expected))); this->m->progress_reporter->reportProgress(percentage); } + int increment = std::max(1, (this->m->events_expected / 100)); while (this->m->events_seen >= this->m->next_progress_report) { - this->m->next_progress_report += (this->m->events_expected / 100); + this->m->next_progress_report += increment; } } |