r729 - in branches/stable-1.0: . archivers

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Jul 23 17:46:46 EDT 2005


Author: icculus
Date: 2005-07-23 17:46:46 -0400 (Sat, 23 Jul 2005)
New Revision: 729

Modified:
   branches/stable-1.0/CHANGELOG
   branches/stable-1.0/CREDITS
   branches/stable-1.0/archivers/zip.c
Log:

From: Jorg Walter
To: icculus at clutteredmind.org
Subject: Bug in zip archiver
Date: Sat, 23 Jul 2005 22:19:09 +0200

Hi!

PhysFS has a bug in the ZIP archive module, function zip_find_start_of_dir. 
Upon encountering a substring match, rc is set to a wrong value. The fix is 
simple: swap both assignments like this:

[patch below  --Ed.]

Some additional info for testing: Symptoms when you encounter this bug: A dir 
is reported as empty although it has files in it; prerequisites or 
encountering it: two dirs, one a substring of another, like "data/txt" and 
"data/txt2", laid out in a way so that variable "middle" points to a file in 
txt2 at some point during zip_find_start_of_dir

By the way, if you're interested in where PhysFS is used: I found this bug 
while writing a patch for DOSBox (http://dosbox.sourceforge.net) to support 
ZIP files. And I'd love to see that enhanced PHYSFS_mount syntax in an 
official release soon *hint* ;);)




Modified: branches/stable-1.0/CHANGELOG
===================================================================
--- branches/stable-1.0/CHANGELOG	2005-07-23 21:46:07 UTC (rev 728)
+++ branches/stable-1.0/CHANGELOG	2005-07-23 21:46:46 UTC (rev 729)
@@ -4,6 +4,7 @@
 
 -- stuff in the stable-1.0 branch, backported from 2.0.0 dev branch, etc ---
 
+07232005 - Fixed bug in zip archiver (thanks, Jörg Walter!).
 07132005 - Moved to zlib122, and security fix discussed here:
            http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-2096
 06122005 - Added support for mingw to Unix build process (thanks, Matze!).

Modified: branches/stable-1.0/CREDITS
===================================================================
--- branches/stable-1.0/CREDITS	2005-07-23 21:46:07 UTC (rev 728)
+++ branches/stable-1.0/CREDITS	2005-07-23 21:46:46 UTC (rev 729)
@@ -76,6 +76,9 @@
 Mingw support:
     Matze Braun
 
+Bug fixes:
+    Jörg Walter
+
 Other stuff:
     Your name here! Patches go to icculus at clutteredmind.org ...
 

Modified: branches/stable-1.0/archivers/zip.c
===================================================================
--- branches/stable-1.0/archivers/zip.c	2005-07-23 21:46:07 UTC (rev 728)
+++ branches/stable-1.0/archivers/zip.c	2005-07-23 21:46:46 UTC (rev 729)
@@ -1208,9 +1208,9 @@
         if (rc == 0)
         {
             char ch = name[dlen];
-            if (ch < '/') /* make sure this isn't just a substr match. */
+            if ('/' < ch) /* make sure this isn't just a substr match. */
                 rc = -1;
-            else if (ch > '/')
+            else if ('/' > ch)
                 rc = 1;
             else 
             {




More information about the physfs-commits mailing list