McNetic/PHPZipStreamer

Zip-File contains errors

witchi opened this issue · 3 comments

Hi,

I have downloaded files from OwnCloud with your ZipStreamer modification. If I test the ZIP integrity, I will get an error:

shell> zip -T ECHO_ZKS_BG0815.zip
warning [ECHO_ZKS_BG0815.zip]: 123 extra bytes at beginning or within zipfile
(attempting to process anyway)
ECHO_ZKS_BG0815/: mismatching "local" filename (ECHO_ZKS_BG0815/ECHO_ZKS_BG00815_V1_2013-10-21/autorun.inf),
continuing with "central" filename version
ECHO_ZKS_BG0815/ECHO_ZKS_BG00815_V1_2013-10-21/: mismatching "local" filename (ECHO_ZKS_BG0815/ECHO_ZKS_BG00815_V1_2013-10-21/autorun.inf),
continuing with "central" filename version
test of ECHO_ZKS_BG0815.zip FAILED

zip error: Zip file invalid, could not spawn unzip, or wrong unzip (original files unmodified)
shell>

The zip-file is 3.2 GB. What's wrong?
André

I have tested the zip file with a Linux command line version and get:

zip -F test_andre.zip --out haha.zip
Fix archive (-F) - assume mostly intact archive
Zip entry offsets appear off by 41 bytes - correcting...
copying: test_andre/
zip warning: Local Entry Flag does not match CD: test_andre/
zip warning: Local Entry name does not match CD: test_andre/
copying: test_andre/autorun.inf
...

But the archive is still corrupt. With the option -FF I will get:

zip -FF test_andre.zip --out haha.zip
Fix archive (-FF) - salvage what can
Found end record (EOCDR) - says expect single disk archive
Scanning for entries...
copying: test_andre/ (0 bytes)
copying: test_andre/autorun.inf
zip warning: no end of stream entry found: test_andre/autorun.inf
zip warning: rewinding and scanning for later entries

The output archive is also corrupt.

I think, there is a problem on the first entry.
Any ideas?
André

Some tests later:
If I select more than 49 files to download with the ZipStreamer, the archive will be corrupt. Also the destination file name is not longer the name of the folder, it is simply ".zip". Maybe there is a problem with the filelist. I only have selected files, no folders.

The archive will also be corrupt, if I select a single folder in OwnCloud to download its content. This is independ from the number of files or the the size.

The problem is the Suhosin installation, which comes with PHP. Set the variable suhosin.get.max_value_length to a larger value than 512 bytes (Apache allows ca. 8000 bytes). This variable limits the size of $_GET[], which is used for the file-list. If you select files, which have long names, you reach the 512 bytes limit and the $_GET[] will be null. This results in a corrupt zip-file.

http://www.php.net/manual/en/reserved.variables.get.php#101469