Browse Source

Merge pull request #106872 from bruvzg/unzip_64pos3

[3.x] Fix unzSeekCurrentFile not resetting total_out_64.
lawnjelly 3 months ago
parent
commit
bc2f565470
2 changed files with 5 additions and 1 deletions
  1. 3 1
      thirdparty/minizip/patches/godot-seek.patch
  2. 2 0
      thirdparty/minizip/unzip.c

+ 3 - 1
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;
 +        }
 +

+ 2 - 0
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;
         }