summaryrefslogtreecommitdiff
path: root/core/io/unzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/io/unzip.c')
-rw-r--r--core/io/unzip.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/core/io/unzip.c b/core/io/unzip.c
index b438021ad7..7aa0a86d13 100644
--- a/core/io/unzip.c
+++ b/core/io/unzip.c
@@ -10,7 +10,7 @@
Modifications for Zip64 support on both zip and unzip
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read MiniZip_info.txt
+ For more info read LICENSE-MiniZip.txt
------------------------------------------------------------------------------------
@@ -1031,10 +1031,19 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
if (lSeek!=0)
{
- if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
- lSeek=0;
- else
- err=UNZ_ERRNO;
+ if (lSeek<0) {
+ // WORKAROUND for backwards seeking
+ z_off_t pos = ZTELL64(s->z_filefunc, s->filestream);
+ if (ZSEEK64(s->z_filefunc, s->filestream,pos+lSeek,ZLIB_FILEFUNC_SEEK_SET)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ } else {
+ if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ }
}
while(acc < file_info.size_file_extra)