Skip to content

Commit a84820a

Browse files
committed
fix: MurmurHash3: MurmurHash3_x86_128: type needs to be unsigned for
shift to be defined src/OVAL/probes/SEAP/MurmurHash3.c:236:27: runtime error: left shift of 255 by 24 places cannot be represented in type int
1 parent 921f1be commit a84820a

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/OVAL/probes/SEAP/MurmurHash3.c

+15-15
Original file line numberDiff line numberDiff line change
@@ -216,27 +216,27 @@ void MurmurHash3_x86_128 ( const void * key, const int len,
216216
#endif
217217
switch(len & 15)
218218
{
219-
case 15: k4 ^= tail[14] << 16;
220-
case 14: k4 ^= tail[13] << 8;
221-
case 13: k4 ^= tail[12] << 0;
219+
case 15: k4 ^= (uint32_t)tail[14] << 16;
220+
case 14: k4 ^= (uint32_t)tail[13] << 8;
221+
case 13: k4 ^= (uint32_t)tail[12] << 0;
222222
k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
223223

224-
case 12: k3 ^= tail[11] << 24;
225-
case 11: k3 ^= tail[10] << 16;
226-
case 10: k3 ^= tail[ 9] << 8;
227-
case 9: k3 ^= tail[ 8] << 0;
224+
case 12: k3 ^= (uint32_t)tail[11] << 24;
225+
case 11: k3 ^= (uint32_t)tail[10] << 16;
226+
case 10: k3 ^= (uint32_t)tail[ 9] << 8;
227+
case 9: k3 ^= (uint32_t)tail[ 8] << 0;
228228
k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
229229

230-
case 8: k2 ^= tail[ 7] << 24;
231-
case 7: k2 ^= tail[ 6] << 16;
232-
case 6: k2 ^= tail[ 5] << 8;
233-
case 5: k2 ^= tail[ 4] << 0;
230+
case 8: k2 ^= (uint32_t)tail[ 7] << 24;
231+
case 7: k2 ^= (uint32_t)tail[ 6] << 16;
232+
case 6: k2 ^= (uint32_t)tail[ 5] << 8;
233+
case 5: k2 ^= (uint32_t)tail[ 4] << 0;
234234
k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
235235

236-
case 4: k1 ^= tail[ 3] << 24;
237-
case 3: k1 ^= tail[ 2] << 16;
238-
case 2: k1 ^= tail[ 1] << 8;
239-
case 1: k1 ^= tail[ 0] << 0;
236+
case 4: k1 ^= (uint32_t)tail[ 3] << 24;
237+
case 3: k1 ^= (uint32_t)tail[ 2] << 16;
238+
case 2: k1 ^= (uint32_t)tail[ 1] << 8;
239+
case 1: k1 ^= (uint32_t)tail[ 0] << 0;
240240
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
241241
};
242242
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)

0 commit comments

Comments
 (0)