Commit Graph

479 Commits

Author SHA1 Message Date
Ryan C. Gordon a45afc5d50 Catch access to paths that are just "." or ".." without any path separator. 2017-10-26 14:37:16 -04:00
Ryan C. Gordon 62d24e228f Fixed mounting a symlink to a real directory. 2017-10-26 14:21:36 -04:00
Ryan C. Gordon 26db9376da Fixed some infinite loops that a maliciously-crafted .iso can trigger.
These bugs exposed by American Fuzzy Lop (AFL), a powerful fuzzer.

http://lcamtuf.coredump.cx/afl/
2017-10-23 14:58:54 -04:00
Ryan C. Gordon 1c7945461d Don't allow NULL filenames to be mounted.
Regardless of what the 3.0.0 documentation says, PhysicsFS never handled this
correctly, so now we check for it so you can't get into crashy situations.

Corrected documentation to reflect reality.
2017-10-23 12:40:59 -04:00
Ryan C. Gordon f5e5b586c7 Fixed crash when duplicating PHYSFS_Io for zipfiles. 2017-10-23 12:16:51 -04:00
Ryan C. Gordon 9e756312d5 Bumped version to 3.0.0! 2017-09-27 11:54:25 -04:00
Ryan C. Gordon bb2c38cdea Added SLB to list of supported archives. 2017-09-27 12:33:36 -04:00
Ryan C. Gordon 9b42fe23fd Fixed doxygen comment. 2017-09-27 12:07:55 -04:00
Ryan C. Gordon 3d8817346d Fixed seeking within read buffers. 2017-09-25 16:32:52 -04:00
Ryan C. Gordon 425131ccda Simplified doBufferedRead().
No longer recurses, and deals with EOF correctly.
2017-09-25 16:19:59 -04:00
Ryan C. Gordon 2b78f64c11 Fixed PHYSFS_flush(). 2017-09-25 16:19:30 -04:00
Ryan C. Gordon 395b2b02dd OS/2: Patched to compile. 2017-09-15 19:52:24 -04:00
Ryan C. Gordon 69d3df3286 OS/2: Deal with UTF-8 -> codepage conversion on older OS/2 installs.
(untested attempt.)
2017-09-15 19:49:40 -04:00
Ryan C. Gordon 7a26b83733 OS/2: don't report failures on Unicode conversion on older OS/2 installs. 2017-09-14 23:36:51 -04:00
Francesco Bertolaccini e728c65912 vdf: Don't add directories; UNPK_addEntry()/DirTree will fill in parents. 2017-09-03 13:13:51 -04:00
Ryan C. Gordon 21b2fd39f2 Made PHYSFS_caseFold() a public API. 2017-08-20 02:02:08 -04:00
Ryan C. Gordon bc2ddf0a53 Added some warnings to the docs about converting bad Unicode strings. 2017-08-20 02:01:50 -04:00
Ryan C. Gordon 9f8ecb91cb unicode: Added UTF-16 and UCS-4 stricmp functions. 2017-08-20 01:18:41 -04:00
Ryan C. Gordon eb75883226 OS/2: Fixed NULL pointer dereference. 2017-08-20 01:18:05 -04:00
Ryan C. Gordon 689333dc8f Clarified some documentation. 2017-08-20 00:35:25 -04:00
Ryan C. Gordon 6ad71878fe Updated PHYSFS_Archiver with PHYSFS_EnumerateCallbackResult change. 2017-08-19 11:19:28 -04:00
Ryan C. Gordon 4e0d3d55e9 Make PHYSFS_EnumerateCallback return an enum instead of an int. 2017-08-19 10:40:27 -04:00
Ryan C. Gordon 5fb9119ebc windows: Disable _CRT_SECURE_NO_WARNINGS again. 2017-08-16 21:19:16 -04:00
Ryan C. Gordon 7607eeeb00 Cleaned up some header inclusion politics. 2017-08-16 20:03:24 -04:00
Ryan C. Gordon e19422cc06 qnx: Added more proper support for QNX. 2017-08-16 20:02:54 -04:00
Ryan C. Gordon cd0ccf64ed Bump version to 2.1.1, since we've been at 2.1.0 for 8.5 years. :)
There isn't going to be an official 2.1.1 (or 2.1.0) release; we'll let this
marinate a little and jump to 3.0!
2017-08-15 02:08:24 -04:00
Ryan C. Gordon b311ee44ad Fixed one more Visual Studio compiler warning. 2017-08-14 21:22:30 -04:00
Ryan C. Gordon 735fd14ea4 Whoops, patched to compile. 2017-08-14 21:17:22 -04:00
Ryan C. Gordon 8dfd3cff8d Fixed some compiler warnings on Visual Studio.
(and maybe made a few new ones...)
2017-08-14 21:15:58 -04:00
Ryan C. Gordon 692d5e8219 Fixed some warnings that Xcode brought up. 2017-08-14 19:58:56 -04:00
Ryan C. Gordon 0d1a73fce4 zip: add some zip_resolve() calls, deal with DirTree-inserted parent dirs. 2017-08-14 16:24:19 -04:00
Ryan C. Gordon 395ea71990 This appears to have been fixed at some point. 2017-08-14 14:06:43 -04:00
Ryan C. Gordon 660171f79f Don't fail enumeration if a directory isn't available in a given archive.
That shouldn't be a fatal error, that's a normal case.
2017-08-14 14:05:06 -04:00
Ryan C. Gordon f425f051db Little tweaks to __PHYSFS_initSmallAlloc(). 2017-08-14 13:57:57 -04:00
Ryan C. Gordon 8db27a1236 Fix symlink filtering for enumeration under a virtual mount point. 2017-08-14 11:43:18 -04:00
Ryan C. Gordon cfe3f0180b Make PHYSFS_exists() work with mounts from PHYSFS_mountIo(io, NULL, ...)
(Actually, from any mount function that accepts a bogus/NULL filename.)
2017-08-14 03:06:42 -04:00
Ryan C. Gordon 3b7ee3974c Don't set readonly if PHYSFS_stat()'ing something not in the write dir.
This API is meant to report what the archivers think about an item and not
actually tell you if a PHYSFS_openWrite() will succeed on it.
2017-08-14 02:46:07 -04:00
Ryan C. Gordon 63277e500c Turns out we were doing this for a (maybe not good, but reasonable) reason. 2017-08-14 02:42:13 -04:00
Ryan C. Gordon 3078acd1eb Archivers can now specify whether an archive definitely was intended for them.
So if a zip file goes to the zip archiver but is corrupted, the system can now
know not to bother trying other archivers once the zip archiver has had a shot
at it, and just as important: it can report the real error from that archiver
instead of a generic "unsupported."
2017-08-14 02:28:00 -04:00
Ryan C. Gordon 2a6215394b Reduced some FIXME-3.0 tags to normal FIXME. They can wait. 2017-08-14 01:35:10 -04:00
Ryan C. Gordon 88e7f3eb0f Sanity check archivers that should only have low-ASCII filename. 2017-08-14 01:29:45 -04:00
Ryan C. Gordon 9c9325c2c5 Filled in more documentation. 2017-08-14 01:28:30 -04:00
Ryan C. Gordon dd68246737 7z: do global initialization once without risking a race condition. 2017-08-13 22:53:38 -04:00
Ryan C. Gordon 1364f6a915 PHYSFS_setSaneConfig uses enum callbacks now. 2017-08-13 19:45:31 -04:00
Ryan C. Gordon 0d61295781 Improved some documentation. 2017-08-13 17:11:14 -04:00
Ryan C. Gordon cc3ac9539e Patched to compile on various platforms and compilers. 2017-08-12 03:10:19 -04:00
Ryan C. Gordon 7fcddfb741 Don't mark the PHYSFS_EnumFilesCallback _typedef_ as deprecated.
It upsets several compilers when building PhysicsFS itself.
2017-08-12 03:06:06 -04:00
Ryan C. Gordon 6da5bea804 Updated docs to use PHYSFS_getLastErrorCode() instead of PHYSFS_getLastError().
(a few other documentation fixes probably slipped in here, too.)
2017-08-12 02:39:24 -04:00
Ryan C. Gordon f6a8533ba2 FIXME removal: document enumerateFiles() sorting promises. 2017-08-12 02:24:38 -04:00
Ryan C. Gordon db2201e4e1 Added some FIXMEs and deprecated PHYSFS_getLastError(). 2017-08-12 02:21:11 -04:00
Ryan C. Gordon ee9687bca9 Reworked enumeration to be more powerful.
Now callbacks can stop further enumeration and report errors, if they had a
catastrophic issue or just found what they needed and don't need to process
any more items.

Also, the actual enumerators can report errors instead of silently dropping
items. This led to several other fixes as all these implementations got
audited and reworked.

The original, non-callback enumerator now returns NULL if it can't produce a
complete list instead of dropping items and returning a partial list.
2017-08-12 02:19:22 -04:00
Ryan C. Gordon b082bc3432 Removed __PHYSFS_stricmpASCII functions.
Nothing was using them, except one OS/2 thing that could live with stricmp.
2017-08-11 01:45:29 -04:00
Ryan C. Gordon 78c1a985ec Made physfs_lzmasdk.h's include-once blockers match other files' formatting. 2017-08-11 01:29:38 -04:00
Ryan C. Gordon d1f2637ca8 utf8: big improvements to case-insensitive UTF-8 string compare.
- Dramatically reduce RAM usage: uses between 8 and 11 kilobytes less static
memory for its internal case-folding tables.
- Actually works now. It would fail unconditionally if a codepoint folded
into multiple codepoints, even if the compared string contained those exact
codepoints.
- Now a public API!
- Removed __PHYSFS_utf8strnicmp(): nothing was using it, it was incorrect
anyhow, and what does 'n' represent when either string might case-fold to
something larger in-flight, anyhow?
2017-08-11 01:39:22 -04:00
Ryan C. Gordon 587ec88a0d FIXME removal: this code is fine, I guess. 2017-08-10 12:31:41 -04:00
Ryan C. Gordon 1efdb62a8f haiku: CD-ROM detection should report any mounted volume on a B_CD device.
Most discs only use the "raw" device, but it turns out the Haiku installation
"anyboot" images don't, and those would fail to detect here. If there's
some multi-partition disc thing and the OS mounted each separately, we should
report each of them.
2017-08-10 12:31:06 -04:00
Ryan C. Gordon 0e778b0b16 FIXME removal: it's okay for the PHYSFS_Io to be NULL here.
We use this technique in several other places, too.
2017-08-08 15:27:32 -04:00
Ryan C. Gordon 961c0604dc apple: Patched to compile on XCode versions < 7. 2017-08-08 11:57:44 -04:00
Ryan C. Gordon c52be25d1e windows: minor cleanup. 2017-08-08 03:37:09 -04:00
Ryan C. Gordon 982411ec8a apple: Start using some Cocoa APIs, clean up a few related things. 2017-08-08 03:36:56 -04:00
Ryan C. Gordon 0a730433ae Rename physfs_platform_macos.c to physfs_platform_apple.m
It's not really "macOS," it's all of Apple's platforms (iOS, watchOS,
tvOS...AppleCarOS? heh), and second...we're about to need access to Cocoa
APIs, so we need it to be Objective-C. I fought as long as I could.  :/
2017-08-08 02:34:25 -04:00
Ryan C. Gordon eb46d82500 Fixed compiler warnings on GCC. 2017-08-06 15:59:46 -04:00
Ryan C. Gordon af555317b9 Fixed compiler warnings on Visual Studio. 2017-08-06 15:58:39 -04:00
Ryan C. Gordon f0eb5c0db9 Marked a bunch of things as "FIXME-3.0" that I want resolved before 3.0 ships. 2017-08-06 15:54:44 -04:00
Ryan C. Gordon 0287160f3c Removed some FIXMEs that aren't valid. 2017-08-06 13:56:45 -04:00
Ryan C. Gordon 1d6c519c5e windows: Patched to compile! (...?) 2017-08-06 12:27:18 -04:00
Ryan C. Gordon 2176364a16 windows: (maybe) patched to compile on Visual Studio. 2017-08-06 12:19:33 -04:00
Ryan C. Gordon 36c51d40d1 PHYSFS_File buffering now uses size_t.
This lets you have the full address space but not take up unnecessary space
on 32-bit platforms...not to mention removes a bunch of typecasting.
2017-08-06 10:33:21 -04:00
Ryan C. Gordon 114bfd1b21 windows: PHYSFS_FILETYPE_OTHER files now report real filesize in PHYSFS_stat().
I don't know if it's _meaningful_, but if the OS reports it, so do we.
2017-08-06 09:25:05 -04:00
Ryan C. Gordon a7ce178eec Add basic atomic operations for refcounting, etc. 2017-08-06 09:21:38 -04:00
Ryan C. Gordon 61bdee4d78 __PHYSFS_platformDeinit() should return void.
What are you going to do if this fails, anyhow?
2017-08-06 01:30:58 -04:00
Ryan C. Gordon 248167af40 windows: Removed (what I think is) a copy/paste error. 2017-08-05 01:26:07 -04:00
Ryan C. Gordon be9bf023d0 windows: Use a real synchronization primitive for CD detection thread init.
Before we were waiting on a volatile int in a tight loop with a Sleep(50).
2017-08-05 01:24:53 -04:00
Ryan C. Gordon befc894b1f More FIXME cleanups. 2017-08-04 22:35:49 -04:00
Ryan C. Gordon b6e139fc22 Make compile-time asserts more readable. 2017-08-04 22:32:57 -04:00
Ryan C. Gordon 0d249cae36 FIXME removal: This is an appropriate error code already. 2017-08-04 22:32:34 -04:00
Ryan C. Gordon cc2c29b207 Removed FIXME: this was already fixed at some point. 2017-08-04 22:31:56 -04:00
Ryan C. Gordon 093dcb555b os/2: Patched to compile (?). 2017-08-02 16:40:07 -04:00
Ryan C. Gordon 3f9ffddc83 os/2: attempt to get cpuid support on OpenWatcom builds. 2017-08-02 16:34:02 -04:00
Ryan C. Gordon 1e850d32ea windows: Patched to compile. 2017-08-02 13:06:56 -04:00
Ryan C. Gordon 007c2fc037 windows: Just pass HANDLEs around instead of wrapping in a struct.
We don't need the "readonly" field of this struct, because it was only used
to protect flushes on non-writable handles, but PHYSFS_flush() also keeps
track of what's read-only and won't call into the platform layer anyhow.

HANDLEs are typedef'd to be "void *" on Windows, so this is safe (so long as
we check for INVALID_HANDLE_VALUE, which is ((void*)-1), when creating new
handles.
2017-08-02 13:02:43 -04:00
Ryan C. Gordon bea510def0 windows: Fixed logic bug. 2017-08-02 12:48:40 -04:00
Ryan C. Gordon 02c2c4736e windows: better test for WinRT vs win32 (...I think...?) 2017-08-02 12:48:31 -04:00
Ryan C. Gordon 5ab8df339d Updated Unicode case folding support to something 10 years newer. :) 2017-07-31 16:32:47 -04:00
Ryan C. Gordon 32930ef41d Fixed compiler warning. 2017-07-26 16:08:32 -04:00
Ryan C. Gordon 0e7f3ee6a1 Added an assert for a FIXME that is now handled elsewhere. 2017-07-25 19:55:58 -04:00
Ryan C. Gordon 1e2650b6fc Serious cleanup and update of Windows RT support.
This compiles for WinRT, but isn't otherwise tested at all yet.
2017-07-24 03:29:33 -04:00
Ryan C. Gordon c74f4cb007 Minor cleanup. 2017-07-24 02:37:22 -04:00
Ryan C. Gordon a5461ddcd9 Some minor preprocessor nitpicks. 2017-07-24 02:36:58 -04:00
Ryan C. Gordon 8c13bd27d6 unix: getmntinfo() should proabably be set to MNT_NOWAIT to avoid blocking. 2017-07-22 20:05:17 -04:00
Ryan C. Gordon bc28fb74b4 Minor QNX fix; don't warn about CD-ROM support (for now). 2017-07-22 20:04:38 -04:00
Ryan C. Gordon e2750bff62 Apple refers to "Mac OS X" as "macOS" now. 2017-07-22 13:50:40 -04:00
Ryan C. Gordon 6d91dde273 Rename __PHYSFS_Archiver_SZIP to __PHYSFS_Archiver_7Z. 2017-07-22 13:50:03 -04:00
Ryan C. Gordon 1fa4be6f66 Minor documentation updates. 2017-07-22 13:48:31 -04:00
Ryan C. Gordon db349bd067 Update filename comments. 2017-07-22 13:19:57 -04:00
Ryan C. Gordon 18c89c1cbc Renamed all the sources to start with "physfs_"
So now you can drop this into your program and not worry about filename
conflicts, or where "platform_unix.c" came from in the debugger, etc.

Also renamed the "beos" sources to "haiku" and "macosx" to "macos" to match
modern platform names.
2017-07-22 12:59:06 -04:00
Ryan C. Gordon ace324cdc8 Minor code cleanups: whitespace fixes, 80-column overflows, wrong comments. 2017-07-22 12:47:32 -04:00
Ryan C. Gordon c1defd3ec4 vdf: Migrated to new, improved unpacked archiver infrastructure. 2017-07-22 12:42:34 -04:00
Ryan C. Gordon eefc757398 Added some TODOs to the ISO9660 code. 2017-07-22 12:16:37 -04:00
Ryan C. Gordon 8ee7f5d351 Fixed compiler warnings. 2017-07-21 22:38:50 -04:00