Print this page
11204 smatch issue in zlib/deflate.c


 171  *    characters and the first MIN_MATCH bytes of str are valid (except for
 172  *    the last MIN_MATCH-1 bytes of the input file).
 173  */
 174 #ifdef FASTEST
 175 #define INSERT_STRING(s, str, match_head) \
 176    (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
 177     match_head = s->head[s->ins_h], \
 178     s->head[s->ins_h] = (Pos)(str))
 179 #else
 180 #define INSERT_STRING(s, str, match_head) \
 181    (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
 182     match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
 183     s->head[s->ins_h] = (Pos)(str))
 184 #endif
 185 
 186 /* ===========================================================================
 187  * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
 188  * prev[] will be initialized on the fly.
 189  */
 190 #define CLEAR_HASH(s) \

 191     s->head[s->hash_size-1] = NIL; \
 192     zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));


 193 
 194 /* ===========================================================================
 195  * Slide the hash table when sliding the window down (could be avoided with 32
 196  * bit values at the expense of memory usage). We slide even when level == 0 to
 197  * keep the hash table consistent if we switch back to level > 0 later.
 198  */
 199 local void slide_hash(s)
 200     deflate_state *s;
 201 {
 202     unsigned n, m;
 203     Posf *p;
 204     uInt wsize = s->w_size;
 205 
 206     n = s->hash_size;
 207     p = &s->head[n];
 208     do {
 209         m = *--p;
 210         *p = (Pos)(m >= wsize ? m - wsize : NIL);
 211     } while (--n);
 212     n = wsize;




 171  *    characters and the first MIN_MATCH bytes of str are valid (except for
 172  *    the last MIN_MATCH-1 bytes of the input file).
 173  */
 174 #ifdef FASTEST
 175 #define INSERT_STRING(s, str, match_head) \
 176    (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
 177     match_head = s->head[s->ins_h], \
 178     s->head[s->ins_h] = (Pos)(str))
 179 #else
 180 #define INSERT_STRING(s, str, match_head) \
 181    (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
 182     match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
 183     s->head[s->ins_h] = (Pos)(str))
 184 #endif
 185 
 186 /* ===========================================================================
 187  * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
 188  * prev[] will be initialized on the fly.
 189  */
 190 #define CLEAR_HASH(s) \
 191     do { \
 192         s->head[s->hash_size-1] = NIL; \
 193         zmemzero((Bytef *)s->head, \
 194         (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
 195     } while (0)
 196 
 197 /* ===========================================================================
 198  * Slide the hash table when sliding the window down (could be avoided with 32
 199  * bit values at the expense of memory usage). We slide even when level == 0 to
 200  * keep the hash table consistent if we switch back to level > 0 later.
 201  */
 202 local void slide_hash(s)
 203     deflate_state *s;
 204 {
 205     unsigned n, m;
 206     Posf *p;
 207     uInt wsize = s->w_size;
 208 
 209     n = s->hash_size;
 210     p = &s->head[n];
 211     do {
 212         m = *--p;
 213         *p = (Pos)(m >= wsize ? m - wsize : NIL);
 214     } while (--n);
 215     n = wsize;