From daf23fd4c6a4f02d3c8936115ec04f1a4900b9eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Tue, 27 May 2025 18:35:11 +0300 Subject: [PATCH] [3.x] Fix unzSeekCurrentFile not resetting total_out_64. --- thirdparty/minizip/patches/godot-seek.patch | 4 +++- thirdparty/minizip/unzip.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/thirdparty/minizip/patches/godot-seek.patch b/thirdparty/minizip/patches/godot-seek.patch index 649de2fe2fb..05011fc31ca 100644 --- a/thirdparty/minizip/patches/godot-seek.patch +++ b/thirdparty/minizip/patches/godot-seek.patch @@ -145,7 +145,7 @@ index ea05b7d62a..981ba3c0cb 100644 s->pfile_in_zip_read = pfile_in_zip_read_info; s->encrypted = 0; -@@ -1510,6 +1544,85 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method, +@@ -1510,6 +1544,87 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method, return UNZ_OK; } @@ -178,6 +178,7 @@ index ea05b7d62a..981ba3c0cb 100644 + pfile_in_zip_read_info->extra_size + pos; + + pfile_in_zip_read_info->stream.avail_in = (uInt)0; ++ pfile_in_zip_read_info->total_out_64 = pos; + pfile_in_zip_read_info->stream.total_out = pos; + + return ZSEEK64(pfile_in_zip_read_info->z_filefunc, @@ -202,6 +203,7 @@ index ea05b7d62a..981ba3c0cb 100644 + + pfile_in_zip_read_info->stream.avail_in = (uInt)0; + pfile_in_zip_read_info->stream.total_out = 0; ++ pfile_in_zip_read_info->total_out_64 = 0; + pfile_in_zip_read_info->stream.next_in = 0; + } + diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c index 981ba3c0cb7..52bb72645a8 100644 --- a/thirdparty/minizip/unzip.c +++ b/thirdparty/minizip/unzip.c @@ -1573,6 +1573,7 @@ extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) { pfile_in_zip_read_info->extra_size + pos; pfile_in_zip_read_info->stream.avail_in = (uInt)0; + pfile_in_zip_read_info->total_out_64 = pos; pfile_in_zip_read_info->stream.total_out = pos; return ZSEEK64(pfile_in_zip_read_info->z_filefunc, @@ -1597,6 +1598,7 @@ extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) { pfile_in_zip_read_info->stream.avail_in = (uInt)0; pfile_in_zip_read_info->stream.total_out = 0; + pfile_in_zip_read_info->total_out_64 = 0; pfile_in_zip_read_info->stream.next_in = 0; }