[physfs] End-of-file seek error

Chris Robinson chris.kcat at gmail.com
Sat Dec 13 16:15:55 EST 2014


I noticed this occurring when libmpg123 would try to seek to the end of 
a file to get its length and PHYSFS_seek would return an error when 
specifying the (valid) file length as the offset, but only when using 
certain archive formats (I initially noticed with .wad files).

I believe I've tracked the cause down to UNPK_seek:
<https://hg.icculus.org/icculus/physfs/file/52a7487e505c/src/archiver_unpacked.c#l76>
The line
BAIL_IF_MACRO(offset >= entry->size, PHYSFS_ERR_PAST_EOF, 0);
causes it to error when the offset is equal to the file's size, not just 
past it. Other archive handlers that don't rely on UNPK_seek (such as 
native directories and 7z/lzma) work as expected, allowing libmpg123 to 
seek to the end of the file without issue.


More information about the physfs mailing list