1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-22 17:22:18 -05:00

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
This commit is contained in:
Samuel Lidén Borell 2014-02-15 22:10:43 +00:00 committed by Berke Viktor
parent 3fb04bee85
commit d8c80cd277

View File

@ -136,7 +136,7 @@ char *fish_decrypt(const char *key, size_t keylen, const char *data) {
for (i = 0; i < 12; i++) { for (i = 0; i < 12; i++) {
d = fish_unbase64[(const unsigned char)*(data++)]; d = fish_unbase64[(const unsigned char)*(data++)];
if (d == IB) goto decrypt_end; if (d == IB) goto decrypt_end;
binary[word] |= d << bit; binary[word] |= (unsigned long)d << bit;
bit += 6; bit += 6;
if (i == 5) { if (i == 5) {
bit = 0; bit = 0;