Commit d6c9c194 authored by unknown's avatar unknown

Bug#8840 Empty string comparison and character set 'cp1250'

Secondary weight out of bounds was picked up in mistake when
the string is empty, instead of returning 0.

parent 763ce399
-- require r/have_cp1250_ch.require
disable_query_log;
show collation like "cp1250_czech_cs";
enable_query_log;
SHOW COLLATION LIKE 'cp1250_czech_cs';
Collation Charset Id Default Compiled Sortlen
cp1250_czech_cs cp1250 34 Yes 2
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
INSERT INTO t1 VALUES ('');
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
a length(a) a='' a=' ' a=' '
0 1 1 1
DROP TABLE t1;
Collation Charset Id Default Compiled Sortlen
cp1250_czech_cs cp1250 34 Yes 2
-- source include/have_cp1250_ch.inc
SHOW COLLATION LIKE 'cp1250_czech_cs';
#
# Bugs: #8840: Empty string comparison and character set 'cp1250'
#
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
INSERT INTO t1 VALUES ('');
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
DROP TABLE t1;
...@@ -416,7 +416,7 @@ static struct wordvalue doubles[] = { ...@@ -416,7 +416,7 @@ static struct wordvalue doubles[] = {
#define NEXT_CMP_VALUE(src, p, pass, value, len) \ #define NEXT_CMP_VALUE(src, p, pass, value, len) \
while (1) { \ while (1) { \
if (IS_END(p, src, len)) { \ if (IS_END(p, src, len)) { \
if (pass == 0) { p = src; pass++; } \ if (pass == 0 && len > 0) { p= src; pass++; } \
else { value = 0; break; } \ else { value = 0; break; } \
} \ } \
value = ((pass == 0) ? _sort_order_win1250ch1[*p] \ value = ((pass == 0) ? _sort_order_win1250ch1[*p] \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment