From bb41ff0b77820134bd47640ba93249dd4a1b01c4 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Sat, 24 Jan 2015 11:11:34 +0900 Subject: 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. --- lib/unictype/joininggroup_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/unictype/joininggroup_of.c') 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; -- cgit v1.2.1