summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-09-06 15:03:43 +0500
committerunknown <bar@mysql.com>2004-09-06 15:03:43 +0500
commit9d8d16ccf7584b4c40b0bfab9eee6662f6e39c56 (patch)
tree82e3be2ad156af2acfa6fc5080956f2879bdf0dd
parent7d0df267806962fc9151936a560ffc9ac9724deb (diff)
downloadmariadb-git-9d8d16ccf7584b4c40b0bfab9eee6662f6e39c56.tar.gz
Bug #5397: Crash with varchar binary and LIKE
-rw-r--r--mysql-test/r/ctype_utf8.result5
-rw-r--r--mysql-test/t/ctype_utf8.test7
-rw-r--r--strings/ctype-mb.c2
3 files changed, 13 insertions, 1 deletions
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index f3be539251a..c7d015da9dc 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -639,3 +639,8 @@ select * from t1 where str='str';
str
str
drop table t1;
+CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8;
+INSERT INTO t1 VALUES ('test');
+SELECT a FROM t1 WHERE a LIKE '%te';
+a
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 2c531d4e5d2..f5bd9ede673 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -492,3 +492,10 @@ INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str';
drop table t1;
+#
+# Bug #5397: Crash with varchar binary and LIKE
+#
+CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8;
+INSERT INTO t1 VALUES ('test');
+SELECT a FROM t1 WHERE a LIKE '%te';
+DROP TABLE t1;
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 2548a68ab19..25ee85d62b4 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -565,7 +565,7 @@ static int my_wildcmp_mb_bin(CHARSET_INFO *cs,
if (str++ == str_end) return (-1);
}
{
- int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
+ int tmp=my_wildcmp_mb_bin(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
if (tmp <= 0)
return (tmp);
}