summaryrefslogtreecommitdiff
path: root/fc-lang
diff options
context:
space:
mode:
authorTom Anderson <thomasanderson@chromium.org>2018-04-11 11:39:56 -0700
committerBehdad Esfahbod <behdad@behdad.org>2018-04-16 15:23:20 +0200
commitc60ed9ef66e59584f8b54323018e9e6c69925c7e (patch)
tree51f5e68cbaa99a056bdff8d7c922d30d30843ca6 /fc-lang
parenta8a6efa805fc03e790214e8a0bc55843a258d774 (diff)
Fix undefined-shift UBSAN errors
The expression "1 << 31" will cause UBSAN to complain with this error message: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' The same operation on unsigned types is fine, however. This CL replaces the strings "1 <<" with "1U <<".
Diffstat (limited to 'fc-lang')
-rw-r--r--fc-lang/fc-lang.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fc-lang/fc-lang.c b/fc-lang/fc-lang.c
index 4a650e07..503d7125 100644
--- a/fc-lang/fc-lang.c
+++ b/fc-lang/fc-lang.c
@@ -254,7 +254,7 @@ static int compare (const void *a, const void *b)
#define MAX_LANG 1024
#define MAX_LANG_SET_MAP ((MAX_LANG + 31) / 32)
-#define BitSet(map, i) ((map)[(entries[i].id)>>5] |= ((FcChar32) 1 << ((entries[i].id) & 0x1f)))
+#define BitSet(map, i) ((map)[(entries[i].id)>>5] |= ((FcChar32) 1U << ((entries[i].id) & 0x1f)))
int
main (int argc FC_UNUSED, char **argv)