]> git.lizzy.rs Git - zlib.git/commitdiff
Add assertions to fill_window() in deflate.c to match comments.
authorMark Adler <madler@alumni.caltech.edu>
Fri, 23 Sep 2011 06:55:31 +0000 (23:55 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Fri, 23 Sep 2011 06:55:31 +0000 (23:55 -0700)
deflate.c

index 06ca0ee096465e287c6a497c3bec3d3c5bdc322c..b126a7157ee849be54841c609a1f7422d5412ddd 100644 (file)
--- 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");
 }
 
 /* ===========================================================================