mirror of
https://github.com/nextcloud/server.git
synced 2026-05-15 01:49:53 -04:00
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>
This commit is contained in:
parent
d1547ee3b0
commit
ba7cc279e6
1 changed files with 4 additions and 1 deletions
|
|
@ -99,7 +99,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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue