Ver Fonte

Backport from devbranch:

Fixed zip archiver: could do bogus seek if a small, non-zip file got put
 through isArchive().
Ryan C. Gordon há 19 anos atrás
pai
commit
fc6d85b2f4
2 ficheiros alterados com 4 adições e 0 exclusões
  1. 2 0
      CHANGELOG
  2. 2 0
      archivers/zip.c

+ 2 - 0
CHANGELOG

@@ -4,6 +4,8 @@
 
 
 -- stuff in the stable-1.0 branch, backported from 2.0.0 dev branch, etc ---
 -- stuff in the stable-1.0 branch, backported from 2.0.0 dev branch, etc ---
 
 
+05052007 - Fixed zip archiver: could do bogus seek if a small, non-zip file
+           got put through isArchive().
 04022007 - Fixed Doxygen comment.
 04022007 - Fixed Doxygen comment.
 03312007 - Moved DIR archiver to start of the list, so we don't have to have
 03312007 - Moved DIR archiver to start of the list, so we don't have to have
            every other archiver fail to open a directory as a file before
            every other archiver fail to open a directory as a file before

+ 2 - 0
archivers/zip.c

@@ -489,6 +489,8 @@ static PHYSFS_sint64 zip_find_end_of_central_dir(void *in, PHYSFS_sint64 *len)
             break;
             break;
 
 
         filepos -= (maxread - 4);
         filepos -= (maxread - 4);
+        if (filepos < 0)
+            filepos = 0;
     } /* while */
     } /* while */
 
 
     BAIL_IF_MACRO(!found, ERR_NOT_AN_ARCHIVE, -1);
     BAIL_IF_MACRO(!found, ERR_NOT_AN_ARCHIVE, -1);