summaryrefslogtreecommitdiff
path: root/src/encoding.c
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2019-02-23 21:54:05 +0000
committerChristos Zoulas <christos@zoulas.com>2019-02-23 21:54:05 +0000
commit9b2f9d6a315e6f4506b1207e369cb9c7e4339749 (patch)
tree1396864ac073fd677f8fefa903b9d2f5b7f9c053 /src/encoding.c
parent97330b020551a6bafbc6b14161428d805b232c2a (diff)
downloadfile-git-9b2f9d6a315e6f4506b1207e369cb9c7e4339749.tar.gz
cast to unsigned first to appease ubsan (oss-fuzz)
Diffstat (limited to 'src/encoding.c')
-rw-r--r--src/encoding.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/encoding.c b/src/encoding.c
index 8d84669c..b8c2230d 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: encoding.c,v 1.18 2019/02/20 16:15:47 christos Exp $")
+FILE_RCSID("@(#)$File: encoding.c,v 1.19 2019/02/23 21:54:05 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -481,11 +481,11 @@ looks_ucs32(const unsigned char *bf, size_t nbytes, unichar *ubf,
if (bigend)
ubf[(*ulen)++] = bf[i + 3] | (bf[i + 2] << 8)
| (bf[i + 1] << 16)
- | CAST(unichar, bf[i] << 24);
+ | (CAST(unichar, bf[i]) << 24);
else
ubf[(*ulen)++] = bf[i] | (bf[i + 1] << 8)
| (bf[i + 2] << 16)
- | CAST(unichar, bf[i + 3] << 24);
+ | (CAST(unichar, bf[i + 3]) << 24);
if (ubf[*ulen - 1] == 0xfffe)
return 0;