From 8d62a2c7e199de78648466df2eb554834fb9a1ca Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 17 Feb 2017 20:48:02 -0500 Subject: [PATCH] Fix bug with copying z_stream objects around in zip archiver (thanks, Andrei!). zlib expects us to use inflateCopy() to move a z_stream, then inflateEnd() the original, and apparently fails in later versions if you just try to memcpy() it. This is only a bug in the stable-2.0 and stable-1.0 branches; we replaced zlib with miniz on the development branch, which doesn't have this requirement (or an inflateCopy() function at all!). --- archivers/zip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archivers/zip.c b/archivers/zip.c index 54cd7c33..6e9bfb5c 100644 --- a/archivers/zip.c +++ b/archivers/zip.c @@ -327,7 +327,8 @@ static int ZIP_seek(fvoid *opaque, PHYSFS_uint64 offset) return(0); inflateEnd(&finfo->stream); - memcpy(&finfo->stream, &str, sizeof (z_stream)); + inflateCopy(&finfo->stream, &str); + inflateEnd(&str); finfo->uncompressed_position = finfo->compressed_position = 0; } /* if */