unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 89b4f2f5d9ffe169825ed0253f24442c8f03cdad 727 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
From 38386bd482c0a8102a79958cb3eddcb97a167ca3 Mon Sep 17 00:00:00 2001
From: Con Kolivas <kernel@kolivas.org>
Date: Fri, 9 Mar 2018 17:39:40 +1100
Subject: [PATCH] CVE-2017-8842 Fix divide-by-zero in bufRead::get

---
 libzpaq/libzpaq.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libzpaq/libzpaq.h b/libzpaq/libzpaq.h
index 93387da..cbe211d 100644
--- a/libzpaq/libzpaq.h
+++ b/libzpaq/libzpaq.h
@@ -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;

debug log:

solving 89b4f2f5d9 ...
found 89b4f2f5d9 in https://git.savannah.gnu.org/cgit/guix.git

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).