Commit cdd0428a authored by gshchepa/uchum@host.loc's avatar gshchepa/uchum@host.loc

Merge host.loc:/home/uchum/work/5.0-bugteam

into  host.loc:/home/uchum/work/5.1-bugteam
parents 45c80435 686d6578
...@@ -247,4 +247,11 @@ t1 CREATE TABLE `t1` ( ...@@ -247,4 +247,11 @@ t1 CREATE TABLE `t1` (
`c2` text NOT NULL `c2` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=gbk ) ENGINE=MyISAM DEFAULT CHARSET=gbk
drop table t1; drop table t1;
CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk,
b MEDIUMTEXT CHARACTER SET big5);
INSERT INTO t1 VALUES
(REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', '');
SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
DROP TABLES t1;
End of 5.0 tests End of 5.0 tests
...@@ -770,4 +770,13 @@ SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a; ...@@ -770,4 +770,13 @@ SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a;
ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) ROW(1, 2) IN (SELECT t1.a, 2 FROM t2)
1 1
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 SELECT * FROM t1;
SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
1
1
1
1
DROP TABLE t1, t2;
End of 5.0 tests End of 5.0 tests
...@@ -53,4 +53,18 @@ alter table t1 change c1 c1 mediumtext character set gbk not null; ...@@ -53,4 +53,18 @@ alter table t1 change c1 c1 mediumtext character set gbk not null;
show create table t1; show create table t1;
drop table t1; drop table t1;
#
# Bug#35993: severe memory corruption and crash with multibyte conversion
#
CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk,
b MEDIUMTEXT CHARACTER SET big5);
INSERT INTO t1 VALUES
(REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', '');
SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
DROP TABLES t1;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -605,4 +605,17 @@ SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a; ...@@ -605,4 +605,17 @@ SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a;
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bug #36005: crash in subselect with single row
# (subselect_single_select_engine::exec)
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 SELECT * FROM t1;
SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
DROP TABLE t1, t2;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -846,6 +846,7 @@ JOIN::optimize() ...@@ -846,6 +846,7 @@ JOIN::optimize()
"Impossible HAVING" : "Impossible WHERE")); "Impossible HAVING" : "Impossible WHERE"));
zero_result_cause= having_value == Item::COND_FALSE ? zero_result_cause= having_value == Item::COND_FALSE ?
"Impossible HAVING" : "Impossible WHERE"; "Impossible HAVING" : "Impossible WHERE";
tables= 0;
error= 0; error= 0;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -307,15 +307,17 @@ static size_t my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)), ...@@ -307,15 +307,17 @@ static size_t my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
{ {
uint16 e; uint16 e;
size_t dstlen= len; size_t dstlen= len;
uchar *dest_end= dest + dstlen;
len = srclen; len = srclen;
while (len--) while (len-- && dest < dest_end)
{ {
if ((len > 0) && isbig5code(*src, *(src+1))) if ((len > 0) && isbig5code(*src, *(src+1)))
{ {
e = big5strokexfrm((uint16) big5code(*src, *(src+1))); e = big5strokexfrm((uint16) big5code(*src, *(src+1)));
*dest++ = big5head(e); *dest++ = big5head(e);
*dest++ = big5tail(e); if (dest < dest_end)
*dest++ = big5tail(e);
src +=2; src +=2;
len--; len--;
} else } else
......
...@@ -2668,15 +2668,17 @@ static size_t my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)), ...@@ -2668,15 +2668,17 @@ static size_t my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
{ {
uint16 e; uint16 e;
size_t dstlen= len; size_t dstlen= len;
uchar *dest_end= dest + dstlen;
len = srclen; len = srclen;
while (len--) while (len-- && dest < dest_end)
{ {
if ((len > 0) && isgbkcode(*src, *(src+1))) if ((len > 0) && isgbkcode(*src, *(src+1)))
{ {
e = gbksortorder((uint16) gbkcode(*src, *(src+1))); e = gbksortorder((uint16) gbkcode(*src, *(src+1)));
*dest++ = gbkhead(e); *dest++ = gbkhead(e);
*dest++ = gbktail(e); if (dest < dest_end)
*dest++ = gbktail(e);
src+=2; src+=2;
len--; len--;
} else } else
......
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