Merge pull request #8112 from nextcloud/fix-integer-overflow

Fix integer overflow in ChunkingPlugin
This commit is contained in:
Morris Jobke 2018-03-09 10:27:17 +01:00 committed by GitHub
commit ed5008597f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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");
}
}