Browse Source

Fixed zip archiver: could do bogus seek if a small, non-zip file got put
through isArchive().

Ryan C. Gordon 19 năm trước cách đây
mục cha
commit
05e44324c8
2 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 2 0
      CHANGELOG.txt
  2. 2 0
      archivers/zip.c

+ 2 - 0
CHANGELOG.txt

@@ -2,6 +2,8 @@
  * CHANGELOG.
  * CHANGELOG.
  */
  */
 
 
+05052007 - Fixed zip archiver: could do bogus seek if a small, non-zip file
+           got put through isArchive().
 04292007 - Minor const correctness tweak in zip archiver.
 04292007 - Minor const correctness tweak in zip archiver.
 04032007 - Added a "make dist" target for packing up source code releases.
 04032007 - Added a "make dist" target for packing up source code releases.
            Reverted Unix recursive mutex code. There were some portability
            Reverted Unix recursive mutex code. There were some portability

+ 2 - 0
archivers/zip.c

@@ -447,6 +447,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);