Commit d6c9c194 authored by unknown's avatar unknown
Browse files

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
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
-- require r/have_cp1250_ch.require
disable_query_log;
show collation like "cp1250_czech_cs";
enable_query_log;
+9 −0
Original line number Diff line number Diff line
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;
+2 −0
Original line number Diff line number Diff line
Collation	Charset	Id	Default	Compiled	Sortlen
cp1250_czech_cs	cp1250	34		Yes	2
+12 −0
Original line number Diff line number Diff line
-- 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;
+1 −1
Original line number Diff line number Diff line
@@ -416,7 +416,7 @@ static struct wordvalue doubles[] = {
#define NEXT_CMP_VALUE(src, p, pass, value, len)			\
	while (1) {							\
		if (IS_END(p, src, len)) {				\
			if (pass == 0) { p = src; pass++; }		\
			if (pass == 0 && len > 0) { p= src; pass++; }	\
			else { value = 0; break; }			\
		}							\
		value = ((pass == 0) ? _sort_order_win1250ch1[*p]	\