From 65dc7b383985eb4f63cd3e752136db8d9b4be8c0 Mon Sep 17 00:00:00 2001 From: Snappy Team Date: Thu, 28 Oct 2021 04:39:14 +0000 Subject: [PATCH] Pass by reference the first argument of ExtractLowBytes to avoid UB of passing uninitialized argument by value. PiperOrigin-RevId: 406052814 --- snappy.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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