summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-30 14:22:31 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-03-06 18:47:26 +0100
commitfc4e0501f03de66eafb0a3a2d04024a40be17756 (patch)
tree2e2e918e0420c47c9490582c4e84d6682b91e9e9 /apps
parent846b0d6a42ba5997f57a46be399f8067acfa854d (diff)
downloadnextcloud-server-fc4e0501f03de66eafb0a3a2d04024a40be17756.tar.gz
nextcloud-server-fc4e0501f03de66eafb0a3a2d04024a40be17756.zip
Fix integer overflow in ChunkingPlugin
Avoids errors when the size exceeds MAX_INT because of the cast to int. Better cast it to float to avoid this. Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Upload/ChunkingPlugin.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/dav/lib/Upload/ChunkingPlugin.php b/apps/dav/lib/Upload/ChunkingPlugin.php
index a3f6e528c6b..421a2dd519a 100644
--- a/apps/dav/lib/Upload/ChunkingPlugin.php
+++ b/apps/dav/lib/Upload/ChunkingPlugin.php
@@ -97,7 +97,10 @@ class ChunkingPlugin extends ServerPlugin {
return;
}
$actualSize = $this->sourceNode->getSize();
- if ((int)$expectedSize !== $actualSize) {
+
+ // casted to string because cast to float cause equality for non equal numbers
+ // and integer has the problem of limited size on 32 bit systems
+ if ((string)$expectedSize !== (string)$actualSize) {
throw new BadRequest("Chunks on server do not sum up to $expectedSize but to $actualSize bytes");
}
}