From 39f3b9505feed0bc0b04396810b23b2ae3732571 Mon Sep 17 00:00:00 2001 From: npt-1707 Date: Thu, 8 May 2025 03:23:44 +0800 Subject: [PATCH] assimp/contrib/zlib/inflate.c: Fix a bug when getting a gzip header extra field with inflate(). --- assimp/contrib/zlib/inflate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assimp/contrib/zlib/inflate.c b/assimp/contrib/zlib/inflate.c index 575fcdf8..82abd377 100644 --- a/assimp/contrib/zlib/inflate.c +++ b/assimp/contrib/zlib/inflate.c @@ -758,9 +758,10 @@ int flush; copy = state->length; if (copy > have) copy = have; if (copy) { + len = state->head->extra_len - state->length; 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_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy);