operations can write beyond `out+len` so long as they
stay within 258 bytes of `out`.
*/
- if (dist >= len || dist >= functable.chunksize())
+ if (dist >= len || dist >= state->chunksize)
out = functable.chunkcopy(out, out - dist, len);
else
out = functable.chunkmemset(out, dist, len);
state->strm = strm;
state->window = NULL;
state->mode = HEAD; /* to pass state test in inflateReset2() */
+ state->chunksize = functable.chunksize();
ret = PREFIX(inflateReset2)(strm, windowBits);
if (ret != Z_OK) {
ZFREE_STATE(strm, state);
/* if it hasn't been done already, allocate space for the window */
if (state->window == NULL) {
unsigned wsize = 1U << state->wbits;
- state->window = (unsigned char *) ZALLOC_WINDOW(state->strm, wsize + functable.chunksize(), sizeof(unsigned char));
+ state->window = (unsigned char *) ZALLOC_WINDOW(state->strm, wsize + state->chunksize, sizeof(unsigned char));
if (state->window == Z_NULL)
return 1;
- memset(state->window + wsize, 0, functable.chunksize());
+ memset(state->window + wsize, 0, state->chunksize);
}
/* if window not in use yet, initialize */
int sane; /* if false, allow invalid distance too far */
int back; /* bits back of last unprocessed length/lit */
unsigned was; /* initial length of match */
+ uint32_t chunksize; /* size of memory copying chunk */
};
int ZLIB_INTERNAL inflate_ensure_window(struct inflate_state *state);