diff options
-rw-r--r-- | contrib/optimizations/inflate.c | 5 | ||||
-rw-r--r-- | inflate.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/contrib/optimizations/inflate.c b/contrib/optimizations/inflate.c index 81d558b..93776ac 100644 --- a/contrib/optimizations/inflate.c +++ b/contrib/optimizations/inflate.c @@ -771,8 +771,9 @@ int flush; if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); @@ -760,8 +760,9 @@ int flush; if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); |