gzip: fix nondeterministic compression results
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Mar 2012 18:07:02 +0000 (11:07 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Mar 2012 18:07:26 +0000 (11:07 -0700)
Reported by Jakub Wilk in <http://bugs.debian.org/647522>.
* deflate.c (fill_window): Don't let garbage pollute the dictionary.

deflate.c

index 6c195522c963305c137af6bd768e178d334cd057..5405f10eff3f1ec546d00dfe4a57aeb9e4f04243 100644 (file)
--- 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;
         }