Skip to content

Commit a229091

Browse files
committed
potential signedness issue
different fix for 07a33cd: Bug #23296299 : HANDLE_FATAL_SIGNAL (SIG=11) IN MY_TOSORT_UTF32
1 parent 7ae555c commit a229091

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

mysql-test/r/ctype_utf32.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,9 @@ CHAR_LENGTH(TRIM(BOTH 0x61 FROM _utf32 0x00000061))
12691269
SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061));
12701270
CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061))
12711271
1
1272+
select hex(lower(cast(0xffff0000 as char character set utf32))) as c;
1273+
c
1274+
FFFF0000
12721275
#
12731276
# End of 5.5 tests
12741277
#

mysql-test/t/ctype_utf32.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,11 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x0001 FROM _utf32 0x00000061));
876876
SELECT CHAR_LENGTH(TRIM(BOTH 0x61 FROM _utf32 0x00000061));
877877
SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061));
878878

879+
#
880+
# potential signedness issue
881+
#
882+
select hex(lower(cast(0xffff0000 as char character set utf32))) as c;
883+
879884
--echo #
880885
--echo # End of 5.5 tests
881886
--echo #

strings/ctype-ucs2.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Copyright (c) 2003, 2013, Oracle and/or its affiliates
2-
Copyright (c) 2009, 2014, SkySQL Ab.
2+
Copyright (c) 2009, 2016, MariaDB
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public
@@ -1098,7 +1098,7 @@ my_uni_utf16(CHARSET_INFO *cs __attribute__((unused)),
10981098
static inline void
10991099
my_tolower_utf16(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
11001100
{
1101-
int page= *wc >> 8;
1101+
uint page= *wc >> 8;
11021102
if (page < 256 && uni_plane[page])
11031103
*wc= uni_plane[page][*wc & 0xFF].tolower;
11041104
}
@@ -1107,7 +1107,7 @@ my_tolower_utf16(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
11071107
static inline void
11081108
my_toupper_utf16(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
11091109
{
1110-
int page= *wc >> 8;
1110+
uint page= *wc >> 8;
11111111
if (page < 256 && uni_plane[page])
11121112
*wc= uni_plane[page][*wc & 0xFF].toupper;
11131113
}
@@ -1116,7 +1116,7 @@ my_toupper_utf16(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
11161116
static inline void
11171117
my_tosort_utf16(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
11181118
{
1119-
int page= *wc >> 8;
1119+
uint page= *wc >> 8;
11201120
if (page < 256)
11211121
{
11221122
if (uni_plane[page])
@@ -1727,7 +1727,7 @@ my_uni_utf32(CHARSET_INFO *cs __attribute__((unused)),
17271727
static inline void
17281728
my_tolower_utf32(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
17291729
{
1730-
int page= *wc >> 8;
1730+
uint page= *wc >> 8;
17311731
if (page < 256 && uni_plane[page])
17321732
*wc= uni_plane[page][*wc & 0xFF].tolower;
17331733
}
@@ -1736,7 +1736,7 @@ my_tolower_utf32(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
17361736
static inline void
17371737
my_toupper_utf32(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
17381738
{
1739-
int page= *wc >> 8;
1739+
uint page= *wc >> 8;
17401740
if (page < 256 && uni_plane[page])
17411741
*wc= uni_plane[page][*wc & 0xFF].toupper;
17421742
}
@@ -1745,7 +1745,7 @@ my_toupper_utf32(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
17451745
static inline void
17461746
my_tosort_utf32(MY_UNICASE_INFO *const* uni_plane, my_wc_t *wc)
17471747
{
1748-
int page= *wc >> 8;
1748+
uint page= *wc >> 8;
17491749
if (page < 256)
17501750
{
17511751
if (uni_plane[page])

strings/ctype-utf8.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
2-
Copyright (c) 2009, 2013, Monty Program Ab
2+
Copyright (c) 2009, 2016, MariaDB
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public
@@ -1939,7 +1939,7 @@ MY_UNICASE_INFO *const my_unicase_turkish[256]=
19391939
static inline void
19401940
my_tosort_unicode(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
19411941
{
1942-
int page= *wc >> 8;
1942+
uint page= *wc >> 8;
19431943
if (page < 256)
19441944
{
19451945
if (uni_plane[page])
@@ -5024,7 +5024,7 @@ my_wc_mb_utf8mb4_no_range(CHARSET_INFO *cs __attribute__((unused)),
50245024
static inline void
50255025
my_tolower_utf8mb4(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
50265026
{
5027-
int page= *wc >> 8;
5027+
uint page= *wc >> 8;
50285028
if (page < 256 && uni_plane[page])
50295029
*wc= uni_plane[page][*wc & 0xFF].tolower;
50305030
}
@@ -5033,7 +5033,7 @@ my_tolower_utf8mb4(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
50335033
static inline void
50345034
my_toupper_utf8mb4(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
50355035
{
5036-
int page= *wc >> 8;
5036+
uint page= *wc >> 8;
50375037
if (page < 256 && uni_plane[page])
50385038
*wc= uni_plane[page][*wc & 0xFF].toupper;
50395039
}

0 commit comments

Comments
 (0)