diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:24:43 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:24:43 -0700 |
commit | 6b8233bfe00e79134cb1b84fc49d4f750a797f79 (patch) | |
tree | ca2b03b0169568681dc3d9c823e9f0bc4417d6b5 /inflate.c | |
parent | 0484693e1723bbab791c56f95597bd7dbe867d03 (diff) | |
download | zlib-6b8233bfe00e79134cb1b84fc49d4f750a797f79.tar.gz |
zlib 1.2.2.3v1.2.2.3
Diffstat (limited to 'inflate.c')
-rw-r--r-- | inflate.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,5 +1,5 @@ /* inflate.c -- zlib decompression - * Copyright (C) 1995-2004 Mark Adler + * Copyright (C) 1995-2005 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -1334,11 +1334,15 @@ z_streamp source; /* copy state */ zmemcpy(dest, source, sizeof(z_stream)); zmemcpy(copy, state, sizeof(struct inflate_state)); - copy->lencode = copy->codes + (state->lencode - state->codes); - copy->distcode = copy->codes + (state->distcode - state->codes); + if (state->lencode >= state->codes && + state->lencode <= state->codes + ENOUGH - 1) + { + copy->lencode = copy->codes + (state->lencode - state->codes); + copy->distcode = copy->codes + (state->distcode - state->codes); + } copy->next = copy->codes + (state->next - state->codes); if (window != Z_NULL) - zmemcpy(window, state->window, 1U << state->wbits); + zmemcpy(window, state->window, (uInt)(1U << state->wbits)); copy->window = window; dest->state = (voidpf)copy; return Z_OK; |