patch from upstream for determinism issue
[debian/gzip] / debian / patches / determinism.diff
1 From 0a284baeaedca68017f46d2646e4c921aa98a90d Mon Sep 17 00:00:00 2001
2 From: Paul Eggert <eggert@cs.ucla.edu>
3 Date: Sun, 18 Mar 2012 18:07:02 +0000
4 Subject: gzip: fix nondeterministic compression results
5
6 Reported by Jakub Wilk in <http://bugs.debian.org/647522>.
7 * deflate.c (fill_window): Don't let garbage pollute the dictionary.
8 ---
9 diff --git a/deflate.c b/deflate.c
10 index 6c19552..5405f10 100644
11 --- a/deflate.c
12 +++ b/deflate.c
13 @@ -571,6 +571,8 @@ local void fill_window()
14          n = read_buf((char*)window+strstart+lookahead, more);
15          if (n == 0 || n == (unsigned)EOF) {
16              eofile = 1;
17 +            /* Don't let garbage pollute the dictionary.  */
18 +            memzero (window + strstart + lookahead, MIN_MATCH - 1);
19          } else {
20              lookahead += n;
21          }
22 --
23 cgit v0.9.0.2