summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-04-20 17:30:10 +0200
committerVincent Petry <pvince81@owncloud.com>2015-04-20 18:32:40 +0200
commit76dad297ffc4084d2057e2c2312f0c53f1e15f5b (patch)
treebc80e8b29b01c02cbe7b94dc671e16fec62eed61 /lib
parent3e8f6cdba95690a12de4f8d6b99c59f7a823fbb0 (diff)
downloadnextcloud-server-76dad297ffc4084d2057e2c2312f0c53f1e15f5b.tar.gz
nextcloud-server-76dad297ffc4084d2057e2c2312f0c53f1e15f5b.zip
Fix encryption feof to not return too early
This is because stream_read will pre-cache the next block which causes feof($this->source) to return true prematurely. So we cannot rely on it. Fixed encryption stream wrapper unit tests to actually simulate 6k/8k blocks to make sure we cover the matching logic. Added two data files with 8192 and 8193 bytes.
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/stream/encryption.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/files/stream/encryption.php b/lib/private/files/stream/encryption.php
index 4a1df840105..083f8af9e50 100644
--- a/lib/private/files/stream/encryption.php
+++ b/lib/private/files/stream/encryption.php
@@ -243,6 +243,10 @@ class Encryption extends Wrapper {
}
+ public function stream_eof() {
+ return $this->position >= $this->unencryptedSize;
+ }
+
public function stream_read($count) {
$result = '';