CVE-2017-8842 Fix divide-by-zero in bufRead::get

This commit is contained in:
Con Kolivas 2018-03-09 17:39:40 +11:00
parent 74b735ab68
commit 38386bd482

View file

@ -465,7 +465,8 @@ struct bufRead: public libzpaq::Reader {
int get() {
if (progress && !(*s_len % 128)) {
int pct = (total_len - *s_len) * 100 / total_len;
int pct = (total_len > 0) ?
(total_len - *s_len) * 100 / total_len : 100;
if (pct / 10 != *last_pct / 10) {
int i;