Merge pull request #26376 from nextcloud/backport/25804/stable21

[stable21] Do not attempt to read 0 bytes when manually iterating over a non-seekable file
This commit is contained in:
Julius Härtl 2021-03-31 09:44:47 +02:00 committed by GitHub
commit 00daf58da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -456,7 +456,7 @@ class View {
// forward file handle via chunked fread because fseek seem to have failed // forward file handle via chunked fread because fseek seem to have failed
$end = $from + 1; $end = $from + 1;
while (!feof($handle) && ftell($handle) < $end) { while (!feof($handle) && ftell($handle) < $end && ftell($handle) !== $from) {
$len = $from - ftell($handle); $len = $from - ftell($handle);
if ($len > $chunkSize) { if ($len > $chunkSize) {
$len = $chunkSize; $len = $chunkSize;