From eb7cc8c466c2a4ba3f71bc57253e2bca94a2e7f2 Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz Date: Tue, 7 Nov 2023 18:40:43 +0100 Subject: [PATCH] Fixed - Reverted snappy compressor if statements order --- .../snappy/src/Flow/Snappy/SnappyCompressor.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/snappy/src/Flow/Snappy/SnappyCompressor.php b/src/lib/snappy/src/Flow/Snappy/SnappyCompressor.php index 7688553c8..fb95f4c3e 100644 --- a/src/lib/snappy/src/Flow/Snappy/SnappyCompressor.php +++ b/src/lib/snappy/src/Flow/Snappy/SnappyCompressor.php @@ -218,20 +218,20 @@ private function hashFunc(int $key, int $hashFuncShift) : int private function load32(array $array, int $pos) : int { - if (!isset($array[$pos + 3])) { - return $array[$pos] + ($array[$pos + 1] << 8) + ($array[$pos + 2] << 16); - } - - if (!isset($array[$pos + 2])) { - return $array[$pos] + ($array[$pos + 1] << 8); + if (!isset($array[$pos])) { + return 0; } if (!isset($array[$pos + 1])) { return $array[$pos]; } - if (!isset($array[$pos])) { - return 0; + if (!isset($array[$pos + 2])) { + return $array[$pos] + ($array[$pos + 1] << 8); + } + + if (!isset($array[$pos + 3])) { + return $array[$pos] + ($array[$pos + 1] << 8) + ($array[$pos + 2] << 16); } return $array[$pos] + ($array[$pos + 1] << 8) + ($array[$pos + 2] << 16) + ($array[$pos + 3] << 24);