summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-06-09 12:08:46 +0400
committerAlexander Barkov <bar@mariadb.org>2015-06-09 12:08:46 +0400
commitf744b2a15ff3a8e2b93ae4f17ffe5a22af9bcd88 (patch)
tree3df42a4118b4b1660637228aa725e60fb3dd49c5
parent93fc04ff1dc613a9ad75ccc57988a6b57b94b6cb (diff)
downloadmariadb-git-f744b2a15ff3a8e2b93ae4f17ffe5a22af9bcd88.tar.gz
MDEV-8283 crash in get_mm_leaf with xor on binary col
-rw-r--r--mysql-test/r/partition.result13
-rw-r--r--mysql-test/t/partition.test14
-rw-r--r--sql/opt_range.cc4
3 files changed, 29 insertions, 2 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 233494238a5..71adc194693 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -2628,3 +2628,16 @@ alter table t1 drop partition if exists p5;
Warnings:
Note 1507 Error in list of partitions to DROP
DROP TABLE t1;
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8283 crash in get_mm_leaf with xor on binary col
+#
+CREATE TABLE t1(a BINARY(80)) PARTITION BY KEY(a) PARTITIONS 3;
+SELECT 1 FROM t1 WHERE a XOR 'a';
+1
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 754677e9b37..d3161c9338c 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2884,3 +2884,17 @@ alter table t1 drop partition if exists p5;
DROP TABLE t1;
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8283 crash in get_mm_leaf with xor on binary col
+--echo #
+CREATE TABLE t1(a BINARY(80)) PARTITION BY KEY(a) PARTITIONS 3;
+SELECT 1 FROM t1 WHERE a XOR 'a';
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 190cd450240..d8aeca349ec 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -8370,8 +8370,8 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
value->result_type() == STRING_RESULT &&
key_part->image_type == Field::itRAW &&
field->charset() != conf_func->compare_collation() &&
- !(conf_func->compare_collation()->state & MY_CS_BINSORT &&
- (type == Item_func::EQUAL_FUNC || type == Item_func::EQ_FUNC)))
+ !((type == Item_func::EQUAL_FUNC || type == Item_func::EQ_FUNC) &&
+ conf_func->compare_collation()->state & MY_CS_BINSORT))
goto end;
if (value->cmp_type() == TIME_RESULT && field->cmp_type() != TIME_RESULT)
goto end;