4b7078
This issue has been found by Coverity - static analysis tool.
4b7078
4b7078
mysql-5.5.31/strings/ctype-ucs2.c:1707:sign_extension – Suspicious implicit sign extension: "s[0]" with type "unsigned char" (8 bits, unsigned) is promoted in "(s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3]" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "(s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3]" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
4b7078
4b7078
diff -up mariadb-10.0.15/strings/ctype-ucs2.c.orig mariadb-10.0.15/strings/ctype-ucs2.c
4b7078
--- mariadb-10.0.15/strings/ctype-ucs2.c.orig	2014-11-27 15:14:11.129554529 +0100
4b7078
+++ mariadb-10.0.15/strings/ctype-ucs2.c	2014-11-27 15:13:06.806439653 +0100
4b7078
@@ -1932,7 +1932,7 @@ my_utf32_uni(CHARSET_INFO *cs __attribut
4b7078
 {
4b7078
   if (s + 4 > e)
4b7078
     return MY_CS_TOOSMALL4;
4b7078
-  *pwc= (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + (s[3]);
4b7078
+  *pwc= (((my_wc_t)s[0]) << 24) + (s[1] << 16) + (s[2] << 8) + (s[3]);
4b7078
   return 4;
4b7078
 }
4b7078