diff options
author | unknown <bar@mysql.com/bar.intranet.mysql.r18.ru> | 2006-07-25 17:27:53 +0500 |
---|---|---|
committer | unknown <bar@mysql.com/bar.intranet.mysql.r18.ru> | 2006-07-25 17:27:53 +0500 |
commit | 2347325117ccb0b6b22c8d41a968aa2fd8c17bca (patch) | |
tree | 9c6ddcb5e625399f0b492d9d2a34427ad300d225 | |
parent | c939a8d7e561c4914c4004678c4eedde9253450c (diff) | |
download | mariadb-git-2347325117ccb0b6b22c8d41a968aa2fd8c17bca.tar.gz |
Bug#19741 segfault with cp1250 charset + like + primary key + 64bit os
LIKE craashed with a pattern having letters in the range 128..255
(e.g. A WITH ACUTE or C WITH CARON) because of wrong cast from
signed char to unsigned int.
mysql-test/r/ctype_cp1250_ch.result:
Adding test case
mysql-test/t/ctype_cp1250_ch.test:
Adding test case
strings/ctype-win1250ch.c:
Fixing wrong cast from "signed char" -> "uint" to
"signed char" -> "unsigned char" -> uint, to properly
handle bytes 128..255.
-rw-r--r-- | mysql-test/r/ctype_cp1250_ch.result | 8 | ||||
-rw-r--r-- | mysql-test/t/ctype_cp1250_ch.test | 10 | ||||
-rw-r--r-- | strings/ctype-win1250ch.c | 4 |
3 files changed, 20 insertions, 2 deletions
diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result index 533bfb8cb53..b55849e4e12 100644 --- a/mysql-test/r/ctype_cp1250_ch.result +++ b/mysql-test/r/ctype_cp1250_ch.result @@ -42,3 +42,11 @@ id str 6 aaaaaa 7 aaaaaaa drop table t1; +set names cp1250; +create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a)); +insert into t1 values("abcdefghá"); +insert into t1 values("ááèè"); +select a from t1 where a like "abcdefghá"; +a +abcdefghá +drop table t1; diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test index 2d1e5f0bf9d..65550e0c193 100644 --- a/mysql-test/t/ctype_cp1250_ch.test +++ b/mysql-test/t/ctype_cp1250_ch.test @@ -44,4 +44,14 @@ INSERT INTO t1 VALUES (NULL, 'aaaaaaa'); select * from t1 where str like 'aa%'; drop table t1; +# +# Bug#19741 segfault with cp1250 charset + like + primary key + 64bit os +# +set names cp1250; +create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a)); +insert into t1 values("abcdefghá"); +insert into t1 values("ááèè"); +select a from t1 where a like "abcdefghá"; +drop table t1; + # End of 4.1 tests diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index e936ef1d423..b03bbbc155c 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -634,11 +634,11 @@ my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)), ptr++; /* Skip escape */ else if (*ptr == w_one || *ptr == w_many) /* '_' or '%' in SQL */ break; - *min_str = like_range_prefix_min_win1250ch[(uint)(*ptr)]; + *min_str = like_range_prefix_min_win1250ch[(uint) (uchar) (*ptr)]; if (*min_str != min_sort_char) only_min_found= 0; min_str++; - *max_str++ = like_range_prefix_max_win1250ch[(uint)(*ptr)]; + *max_str++ = like_range_prefix_max_win1250ch[(uint) (uchar) (*ptr)]; } *min_length = (uint) (min_str - min_org); |