From d8c80cd277b2f6b3e7955e95d7845f83b89838c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Lid=C3=A9n=20Borell?= Date: Sat, 15 Feb 2014 22:10:43 +0000 Subject: [PATCH] Fix undefined behaviour in left shift This is not a problem with a usual compiler configuration, but LLVM/clang detects it when compiled with: -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv --- plugins/fishlim/fish.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fishlim/fish.c b/plugins/fishlim/fish.c index 1d2d1ce7..93420f23 100644 --- a/plugins/fishlim/fish.c +++ b/plugins/fishlim/fish.c @@ -136,7 +136,7 @@ char *fish_decrypt(const char *key, size_t keylen, const char *data) { for (i = 0; i < 12; i++) { d = fish_unbase64[(const unsigned char)*(data++)]; if (d == IB) goto decrypt_end; - binary[word] |= d << bit; + binary[word] |= (unsigned long)d << bit; bit += 6; if (i == 5) { bit = 0;