[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug#647522: non-deterministic compression results with gzip -n9
From: |
Paul Eggert |
Subject: |
Re: Bug#647522: non-deterministic compression results with gzip -n9 |
Date: |
Sun, 18 Mar 2012 11:19:51 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
Cyril, thanks for the test case. When I used 'valgrind' on it
I found where gzip is accessing uninitialized data. I pushed
into gzip master the patch at the end of this message; it fixed
things for me.
The Debian patch, which zeros out a lot of buffers, should
work if gzip is compressing regular files, but may have
problems in unusual cases if gzip compresses data from
pipes, devices, or other non-regular files, because in that
case short reads may later cause garbage to be put into the
dictionary. So I suggest using the following patch instead.
http://git.savannah.gnu.org/cgit/gzip.git/commit/?id=0a284baeaedca68017f46d2646e4c921aa98a90d
>From b9de47462b1b487cf4024b4c157ee5ac6c5849c3 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Sun, 18 Mar 2012 11:07:02 -0700
Subject: [PATCH] gzip: fix nondeterministic compression results
Reported by Jakub Wilk in <http://bugs.debian.org/647522>.
* deflate.c (fill_window): Don't let garbage pollute the dictionary.
---
deflate.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/deflate.c b/deflate.c
index 6c19552..5405f10 100644
--- a/deflate.c
+++ b/deflate.c
@@ -571,6 +571,8 @@ local void fill_window()
n = read_buf((char*)window+strstart+lookahead, more);
if (n == 0 || n == (unsigned)EOF) {
eofile = 1;
+ /* Don't let garbage pollute the dictionary. */
+ memzero (window + strstart + lookahead, MIN_MATCH - 1);
} else {
lookahead += n;
}
--
1.7.6.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Bug#647522: non-deterministic compression results with gzip -n9,
Paul Eggert <=