From fe6608175b5b965b9d6c2ec3ac72d733cf9244d8 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 4 Dec 2017 15:19:34 +0100 Subject: [PATCH] Update miniz.h Fix test against null bytes to push back. --- contrib/zip/src/miniz.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contrib/zip/src/miniz.h b/contrib/zip/src/miniz.h index b8e4cf230..b0db0005b 100644 --- a/contrib/zip/src/miniz.h +++ b/contrib/zip/src/miniz.h @@ -3030,10 +3030,8 @@ static MZ_FORCEINLINE mz_bool mz_zip_array_ensure_room(mz_zip_archive *pZip, mz_ static MZ_FORCEINLINE mz_bool mz_zip_array_push_back(mz_zip_archive *pZip, mz_zip_array *pArray, const void *pElements, size_t n) { -// assert(NULL != pElements); - if (pElements == NULL) { - return MZ_TRUE; - } + if (n==0) return MZ_TRUE; + assert(NULL != pElements); size_t orig_size = pArray->m_size; if (!mz_zip_array_resize(pZip, pArray, orig_size + n, MZ_TRUE)) return MZ_FALSE; memcpy((mz_uint8*)pArray->m_p + orig_size * pArray->m_element_size, pElements, n * pArray->m_element_size); return MZ_TRUE;