Fixed infinite loop (thanks, Sam!)
authorRyan C. Gordon <icculus@icculus.org>
Sat, 08 Sep 2012 22:18:52 -0400
changeset 1300 4c690ea5d2d9
parent 1297 d842cd8c9f91
child 1301 e7dad5b51954
Fixed infinite loop (thanks, Sam!)
src/archiver_zip.c
--- a/src/archiver_zip.c	Mon Aug 20 14:39:46 2012 -0400
+++ b/src/archiver_zip.c	Sat Sep 08 22:18:52 2012 -0400
@@ -1184,14 +1184,14 @@
         /* we assume you can eat this stack if you handle Zip64 files. */
         PHYSFS_uint8 buf[256 * 1024];
         PHYSFS_uint64 len = pos - offset;
-        PHYSFS_uint32 i;
+        PHYSFS_sint32 i;
 
         if (len > sizeof (buf))
             len = sizeof (buf);
 
         BAIL_IF_MACRO(!io->seek(io, pos - len), ERRPASS, -1);
         BAIL_IF_MACRO(!__PHYSFS_readAll(io, buf, len), ERRPASS, -1);
-        for (i = len - 4; i >= 0; i--)
+        for (i = (PHYSFS_sint32) (len - 4); i >= 0; i--)
         {
             if (buf[i] != 0x50)
                 continue;