in supertuxkart we have started to use the zip file reader from irrlicht. Unfortunately it can't read certain zip files (so far noticed with zip files created on Macs). I think that the problem is actually a design problem of the zip file reader, so here a somewhat thorough description of the bug based on http://en.wikipedia.org/wiki/ZIP_(file_format) (note that the (file_format) belongs to the link, I couldn't convince the URL bbcode to display that link correctly).
Debugging showed that problem are zip files that do not contain the length of the compressed (and uncompressed) chunk in the headers at the beginning of a file. Looking at wikipedia article linked above this appears to be valid:
CZipReader actually tests this condition:If bit 3 of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written, and they are appended (in a 12-byte structure) immediately after the compressed data. The fields in the local header are filled with zero.
Code: Select all
// if bit 3 was set, read DataDescriptor, following after the compressed data
if (entry.header.GeneralBitFlag & ZIP_INFO_IN_DATA_DESCRIPTOR)
{
// read data descriptor
File->read(&entry.header.DataDescriptor, sizeof(entry.header.DataDescriptor));
It looks like it is necessary to actually start reading the central directory at the end of a zip file, in order to find the proper locations of all chunks.
As a test case you can use: http://download.tuxfamily.org/stkaddons ... /Monty.zip
If you try reading this file with irrlicht, the reader only finds two files (and accessing the 2nd file actually causes memory corruption) - the first one a directory 'monty/', the second one 'monty/.DS_Store' is the one triggering the problem. I assume you have a simple program in your test suite that tests zip files, so you should be able to just add this file. Just test for number of files in the zip files.
Zip readers on linux and windows (and I am sure Macs, since it's a Mac file) can read this file without any problems.
Cheers,
Joerg