Merge pull request #22537 from nextcloud/backport/22535/stable19

[stable19] Only disable zip64 if the size is known
This commit is contained in:
Roeland Jago Douma 2020-09-03 08:41:41 +02:00 committed by GitHub
commit 45dcdc3948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -76,8 +76,12 @@ class Streamer {
* would still be possible to create an invalid zip32 file (for example, * would still be possible to create an invalid zip32 file (for example,
* a zip file from files smaller than 4GB with a central directory * a zip file from files smaller than 4GB with a central directory
* larger than 4GiB), but it should not happen in the real world. * larger than 4GiB), but it should not happen in the real world.
*
* We also have to check for a size above 0. As negative sizes could be
* from not fully scanned external storages. And then things fall apart
* if somebody tries to package to much.
*/ */
if ($size < 4 * 1000 * 1000 * 1000 && $numberOfFiles < 65536) { if ($size > 0 && $size < 4 * 1000 * 1000 * 1000 && $numberOfFiles < 65536) {
$this->streamerInstance = new ZipStreamer(['zip64' => false]); $this->streamerInstance = new ZipStreamer(['zip64' => false]);
} elseif ($request->isUserAgent($this->preferTarFor)) { } elseif ($request->isUserAgent($this->preferTarFor)) {
$this->streamerInstance = new TarStreamer(); $this->streamerInstance = new TarStreamer();