Paul Eggert <egg...@cs.ucla.edu> (08/02/2012):
> Thanks very much for the patch.  But can someone who's looked into it
> please explain why 'window' needs to be zeroed out?  This will save me
> time in reviewing the patch.  Thanks.

Welcome. Here's a slightly more detailed analysis. You can find attached
the sample files I used (still from the ppl source package). I managed
to track it down to deflate() (what a surprise!), so I decided to check
the matches. Printing match_length only led me to a single difference,
while printing both match_length and match_start (which according to a
comment is set by longest_match()), I got two differences.

To produce the below-quoted diff, using the attached patch, I did:
| tar xfz ppl.tar.gz
| gzip -9f README CREDITS > match-2
| tar xfz ppl.tar.gz
| gzip -9f CREDITS > match-1
| diff -u match-2 match-1

Of course there's an extra file showing up in the diff, but skipping it,
here's the diff:
|  match: 46 @ 19459
|  match: 8 @ 15659
|  match: 8 @ 15659
| -match: 7 @ 17193
| -match: 6 @ 17193
| +match: 6 @ 19510
| +match: 6 @ 19510
| [ no more matches ]

Interestingly, the size of the CREDITS file is 19579.

Mraw,
KiBi.
From cbe288044df0e149e6da3744f89eb49ce32e6c2a Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <k...@debian.org>
Date: Mon, 13 Feb 2012 01:31:36 +0100
Subject: [PATCH] Pin-point dirty window bug.

---
 deflate.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/deflate.c b/deflate.c
index 1b3ac52..606a2e5 100644
--- a/deflate.c
+++ b/deflate.c
@@ -757,6 +757,7 @@ off_t deflate()
              */
             match_length = longest_match (hash_head);
             /* longest_match() sets match_start */
+            printf("match: %u @ %u\n", match_length, match_start);
             if (match_length > lookahead) match_length = lookahead;
 
             /* Ignore a length 3 match if it is too distant: */
-- 
1.7.9

Attachment: ppl.tar.gz
Description: Binary data

Attachment: signature.asc
Description: Digital signature

Reply via email to