summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2003-07-03 23:25:54 +0500
committerunknown <hf@deer.(none)>2003-07-03 23:25:54 +0500
commitdb5283b30667c9d427228069314f53d38c4ef8f1 (patch)
tree6e0d04ad9fdb97ab2f6dcdf5876f94da2d033bd7
parent1f0d4704634d3ee81eaf3fdedb9ba7ac6df1202e (diff)
parent33c416f67e6ba11ca1e21888be6cd9c0cc647813 (diff)
downloadmariadb-git-db5283b30667c9d427228069314f53d38c4ef8f1.tar.gz
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.0
into deer.(none):/home/hf/work/mysql-4.0.739
-rw-r--r--mysql-test/r/func_str.result10
-rw-r--r--mysql-test/t/func_str.test14
-rw-r--r--sql/item_strfunc.cc2
3 files changed, 25 insertions, 1 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 09818c14462..0bac5111a05 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -247,3 +247,13 @@ elt(status_wnio,data_podp)
NULL
NULL
DROP TABLE t1;
+CREATE TABLE t1 (
+title text
+) TYPE=MyISAM;
+INSERT INTO t1 VALUES ('Congress reconvenes in September to debate welfare and adult education');
+INSERT INTO t1 VALUES ('House passes the CAREERS bill');
+SELECT CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) from t1;
+CONCAT("</a>",RPAD("",(55 - LENGTH(title)),"."))
+NULL
+</a>..........................
+DROP TABLE t1;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 476629f98d3..5ea3654134b 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -137,3 +137,17 @@ INSERT INTO t1 VALUES (8,NULL,'real');
INSERT INTO t1 VALUES (9,NULL,'nowy');
SELECT elt(status_wnio,data_podp) FROM t1 GROUP BY wid;
DROP TABLE t1;
+
+#
+# test for #739
+
+CREATE TABLE t1 (
+ title text
+) TYPE=MyISAM;
+
+INSERT INTO t1 VALUES ('Congress reconvenes in September to debate welfare and adult education');
+INSERT INTO t1 VALUES ('House passes the CAREERS bill');
+
+SELECT CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) from t1;
+
+DROP TABLE t1;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 838fca807a2..caaff4d1613 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1804,7 +1804,7 @@ String *Item_func_rpad::val_str(String *str)
String *res =args[0]->val_str(str);
String *rpad = args[2]->val_str(str);
- if (!res || args[1]->null_value || !rpad)
+ if (!res || args[1]->null_value || !rpad || count < 0)
goto err;
null_value=0;
if (count <= (int32) (res_length=res->length()))