Commit Graph

88 Commits

Author SHA1 Message Date
Ryan C. Gordon 8d62a2c7e1 Fix bug with copying z_stream objects around in zip archiver (thanks, Andrei!).
zlib expects us to use inflateCopy() to move a z_stream, then inflateEnd()
the original, and apparently fails in later versions if you just try to
memcpy() it.

This is only a bug in the stable-2.0 and stable-1.0 branches; we replaced
zlib with miniz on the development branch, which doesn't have this
requirement (or an inflateCopy() function at all!).
2017-02-17 20:48:02 -05:00
Ryan C. Gordon 1cfce370eb Static analysis fixes backported to the stable-2.0 branch. 2014-02-07 16:31:32 -05:00
Ryan C. Gordon 5fe652d7ad Stupid fix for zip_find_entry(). 2012-08-22 16:37:09 -04:00
Ryan C. Gordon 647867b6e4 Backport from dev branch: infinite loop in zip_expand_symlink_path(). 2011-06-01 03:14:11 -04:00
Ryan C. Gordon 6b96ff2524 Backported zip/qpak dir fix from dev branch to stable-2.0. 2011-02-18 12:42:14 -05:00
Ryan C. Gordon d6fbaedb21 Initialize an array to quiet compiler complaining.
Some versions of GCC think this can be used uninitialized. It doesn't appear
 to be the case, but we initialize it to keep the compiler happy. It's probably
 a good idea anyhow.
2010-03-25 15:58:47 -04:00
Ryan C. Gordon d7945d5955 Fixed strict-aliasing issue that gcc 4.4 complains about. 2009-05-03 01:24:41 -07:00
Ryan C. Gordon 3b0e1d7471 Various archiver swap and compare functions now check if they are
swapping/comparing an item against itself, for efficiency and to prevent
 overlapping memcpy() calls.
2008-02-20 12:24:10 +00:00
Ryan C. Gordon 05e44324c8 Fixed zip archiver: could do bogus seek if a small, non-zip file got put
through isArchive().
2007-05-05 05:52:43 +00:00
Ryan C. Gordon 35dcb89748 Minor const correctness tweak in zip archiver. 2007-04-29 08:16:30 +00:00
Ryan C. Gordon 7386320811 Replaced some Malloc and all the alloca() calls with __PHYSFS_smallAlloc(),
which will stack allocate small (128 or less bytes) blocks and Malloc the
 rest...naturally these now have to be paired with __PHYSFS_smallFree() calls,
 so you can't be as lazy as a basic alloca() would let you be. The benefit is
 both less malloc pressure for those temporary allocations and better stack
 overflow safety (so if some jerk tries to push a 78 megabyte string through
 the library as a filename, we won't try to strcpy it to the stack).
2007-03-24 03:54:58 +00:00
Ryan C. Gordon 53bbe35ddd Renamed LICENSE to LICENSE.txt 2007-03-11 10:10:28 +00:00
Ryan C. Gordon ca2489418e Removed config.h references from old autotools build system. 2007-03-11 09:44:21 +00:00
Ryan C. Gordon 1c3d7dcc7c Some minor fixes and cleanups. 2006-04-11 15:01:15 +00:00
Ryan C. Gordon c81367d0ca Changed my email address. 2006-01-01 12:33:19 +00:00
Ryan C. Gordon 6e7e45cdaf API BREAKAGE: Changed PHYSFS_enumerateFilesCallback() to pass the originally
requested directory back to the app.
2005-09-18 21:44:42 +00:00
Ryan C. Gordon 8f3ab12d22 From: Jorg Walter
To: icculus@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* ;);)
2005-07-23 21:46:07 +00:00
Ryan C. Gordon d840403c1c All memory management now goes through allocation hooks instead of directly to
C runtime malloc/realloc/free...
2005-03-14 11:49:30 +00:00
Ryan C. Gordon 0492580bda Removed all the forward declaration cruft from the archivers. 2004-09-29 06:18:04 +00:00
Ryan C. Gordon c2765f8571 Added callback APIs and ripped up the internals everywhere to use them. 2004-09-29 06:09:29 +00:00
Ryan C. Gordon 90031c81f3 Did the same thing to FileHandles than I did to DirHandles, but this
triggered massive tweaking in physfs.c. A lot of code got little
cleanups, which was nice. Less malloc pressure, too, since opening a
file used to allocate a ton of crap and mush it together...now it's
basically down to one structure and the instance data in whatever
archiver.
2004-09-26 13:00:59 +00:00
Ryan C. Gordon 94759513d9 Cleaned up archiver interface to not deal with DirHandles anymore,
which simplifies things, removes some responsibility and code
duplication from the archivers, and trims some malloc pressure.
Also ripped up the allocation hook code a little. We'll try to screw
with memory locking later, since it makes everything ugly and
complex. Oh well.
2004-09-26 00:25:04 +00:00
Ryan C. Gordon 7553af8acf Minor allocation hook corrections. 2004-09-23 23:59:17 +00:00
Ryan C. Gordon c0acfc0118 Initial structure for replacable allocator work. 2004-09-23 06:45:36 +00:00
Ryan C. Gordon f3191d0e85 Off-by-one fix by Dieter Baron...fixes segfault in zip archive searching in
certain cases.
2003-07-20 21:13:25 +00:00
Ryan C. Gordon f4309f51e8 Tabs-to-spaces patch by James Turk. 2003-07-20 21:08:24 +00:00
Ryan C. Gordon b50342ad13 PocketPC fixes (thanks, David Hedbor!) 2003-05-18 07:52:28 +00:00
Ryan C. Gordon 1344feceda Fixed seeking in uncompressed zip entries and handle Java-created JAR files.
(Thanks to "Tree" for pointing out these bugs).
2003-03-30 18:44:59 +00:00
Ryan C. Gordon 6f1d693fe8 Another attempt at type size correctness. 2003-03-12 06:19:37 +00:00
Ryan C. Gordon 01505d8d58 Attempt at type correctness. 2003-03-12 05:39:51 +00:00
Ryan C. Gordon 3a479b6cd8 Now compiles on CodeWarrior 6 for MacOS Classic again. 2003-01-31 04:07:48 +00:00
Ryan C. Gordon 9d82110b57 Some cleanups for PocketPC port. 2002-11-22 06:24:10 +00:00
Ryan C. Gordon 7606e3bf11 Win32 fixes. 2002-09-23 18:35:12 +00:00
Ryan C. Gordon ee077eabec Fixed infinite loop bug, cleaned out tab chars. 2002-08-30 14:30:49 +00:00
Ryan C. Gordon f5e279536c Fixed bug that prevented use when symlinks were disallowed.
More optimizations, too.
2002-08-28 23:32:29 +00:00
Ryan C. Gordon 680de768b7 Fixes. 2002-08-28 08:27:27 +00:00
Ryan C. Gordon c5dfea18cf ZIP_exists() now works with directories. 2002-08-21 22:33:30 +00:00
Ryan C. Gordon d40d951594 Minor signed/unsigned fix...ZIP_isDirectory() now seems to work. 2002-08-21 04:13:56 +00:00
Ryan C. Gordon 1f5b571be7 Bunch of tedious corrections, optimizations, and cleanups. 2002-08-21 02:59:15 +00:00
Ryan C. Gordon 1e2372b44c Generalized sorting routines, and removed individual implementations. 2002-08-20 01:34:27 +00:00
Ryan C. Gordon 912ca3266d Fix for correct cleanup on read error. 2002-07-31 04:18:58 +00:00
Ryan C. Gordon d701627335 Patched memory leaks (thanks, Valgrind!) 2002-07-29 06:18:58 +00:00
Ryan C. Gordon 42be0046aa Natural language #defines and build system support. 2002-07-28 21:03:27 +00:00
Ryan C. Gordon 0ab061308d Initialized some variables to stop compiler whining. 2002-07-27 22:06:25 +00:00
Ryan C. Gordon 1b29c3888c More enumerate fixes. 2002-07-26 17:03:26 +00:00
Ryan C. Gordon 3ae1f1fa80 Changed DirFunctions struct a little. 2002-07-26 06:19:09 +00:00
Ryan C. Gordon 8eeaf6c6d7 Rewrote ZIP_enumerateFiles() again. Hopefully it sucks less this time. 2002-07-25 04:41:43 +00:00
Ryan C. Gordon 7c80bcf537 Disabled shitty enumeration code. Will fix soon. 2002-07-23 22:55:47 +00:00
Ryan C. Gordon a4d07b8e10 More enumeration fixes. I still hate this code. 2002-07-23 22:09:35 +00:00
Ryan C. Gordon 55b7638892 Fixed a double-free. 2002-07-23 21:26:51 +00:00