From 1250ac745d9c826f8bed79dc790ae4256b6dbfab Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Thu, 22 Sep 2011 23:55:31 -0700 Subject: [PATCH] Add assertions to fill_window() in deflate.c to match comments. --- deflate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deflate.c b/deflate.c index 06ca0ee..b126a71 100644 --- a/deflate.c +++ b/deflate.c @@ -1322,6 +1322,8 @@ local void fill_window(s) unsigned more; /* Amount of free space at the end of the window. */ uInt wsize = s->w_size; + Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + do { more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); @@ -1439,6 +1441,9 @@ local void fill_window(s) s->high_water += init; } } + + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "not enough room for search"); } /* ===========================================================================