summaryrefslogtreecommitdiff
path: root/lib/unictype/joininggroup_of.c
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2015-01-24 11:11:34 +0900
committerDaiki Ueno <ueno@gnu.org>2015-01-24 11:12:48 +0900
commitbb41ff0b77820134bd47640ba93249dd4a1b01c4 (patch)
treed3573c00ccecfbe1ca7eff9e893c4cebb3e4f69d /lib/unictype/joininggroup_of.c
parentea6cb044ca0ab57045900a494a0e4ae39ed5372c (diff)
downloadgnulib-bb41ff0b77820134bd47640ba93249dd4a1b01c4.tar.gz
unictype: avoid undefined left-shift behavior
* lib/unictype/bidi_of.c (uc_bidi_class): Building libunistring with gcc's -fsanitize=shift and running its tests triggered: unictype/bidi_of.c:43:60: runtime error: left shift of 40167 by 16 \ places cannot be represented in type 'int' Cast LHS to 'unsigned int' after integer promotion. * lib/unictype/categ_of.c (lookup_withtable): Likewise. * lib/unictype/joininggroup_of.c (uc_joining_group): Likewise.
Diffstat (limited to 'lib/unictype/joininggroup_of.c')
-rw-r--r--lib/unictype/joininggroup_of.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/unictype/joininggroup_of.c b/lib/unictype/joininggroup_of.c
index 95845fbe43..1626231f6d 100644
--- a/lib/unictype/joininggroup_of.c
+++ b/lib/unictype/joininggroup_of.c
@@ -40,7 +40,7 @@ uc_joining_group (ucs4_t uc)
/* level3 contains 7-bit values, packed into 16-bit words. */
unsigned int lookup3 =
((u_joining_group.level3[index3>>4]
- | (u_joining_group.level3[(index3>>4)+1] << 16))
+ | ((unsigned int) u_joining_group.level3[(index3>>4)+1] << 16))
>> (index3 % 16))
& 0x7f;