Skip to content

Commit

Permalink
CVE-2017-8842 Fix divide-by-zero in bufRead::get
Browse files Browse the repository at this point in the history
  • Loading branch information
ckolivas committed Mar 9, 2018
1 parent 74b735a commit 38386bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libzpaq/libzpaq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 38386bd

Please sign in to comment.