summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSnappy Team <no-reply@google.com>2021-10-28 04:39:14 +0000
committerVictor Costan <pwnall@chromium.org>2021-11-14 22:09:42 +0000
commit65dc7b383985eb4f63cd3e752136db8d9b4be8c0 (patch)
tree791b925fad4067e4d65fe174e0cf063b9e3d5422
parentfe18b46322727fe4bc6939326ba6bde1e0858b61 (diff)
downloadsnappy-git-65dc7b383985eb4f63cd3e752136db8d9b4be8c0.tar.gz
Pass by reference the first argument of ExtractLowBytes
to avoid UB of passing uninitialized argument by value. PiperOrigin-RevId: 406052814
-rw-r--r--snappy.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/snappy.cc b/snappy.cc
index 670b87e..ee9a2c4 100644
--- a/snappy.cc
+++ b/snappy.cc
@@ -954,7 +954,7 @@ static inline void Report(const char *algorithm, size_t compressed_size,
// bool TryFastAppend(const char* ip, size_t available, size_t length, T* op);
// };
-static inline uint32_t ExtractLowBytes(uint32_t v, int n) {
+static inline uint32_t ExtractLowBytes(const uint32_t& v, int n) {
assert(n >= 0);
assert(n <= 4);
#if SNAPPY_HAVE_BMI2