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
1 changed files with 1 additions and 1 deletions

View File

@ -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;