Commit b554f4c5 authored by Bjorn Munch's avatar Bjorn Munch

Bug #48888 mysqltest crashes on --replace_result if 'from' is longer than ~1024 symbols

valgrind pointed to a buffer allocated by my_realloc which looked fishy
Replaced size with what was probably intended, added test case.
Now also fixed line after review comment
parent 9ada265d
......@@ -9452,7 +9452,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
if (pa->length+length >= pa->max_length)
{
if (!(new_pos= (uchar*) my_realloc((uchar*) pa->str,
(uint) (pa->max_length+PS_MALLOC),
(uint) (pa->length+length+PS_MALLOC),
MYF(MY_WME))))
DBUG_RETURN(1);
if (new_pos != pa->str)
......@@ -9463,7 +9463,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
char*);
pa->str=new_pos;
}
pa->max_length+=PS_MALLOC;
pa->max_length= pa->length+length+PS_MALLOC;
}
if (pa->typelib.count >= pa->max_count-1)
{
......
......@@ -417,6 +417,9 @@ mysqltest: At line 1: Wrong number of arguments to replace_column in 'replace_co
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a b'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a 1'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 b c '
select "LONG_STRING" as x;
x
LONG_STRING
mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: Invalid integer argument "a"
mysqltest: At line 1: Missing required argument 'connection name' to command 'connect'
......
......@@ -1285,6 +1285,17 @@ select "a" as col1, "c" as col2;
--error 1
--exec echo "--replace_column 1 b c " | $MYSQL_TEST 2>&1
let $long_rep= 1234567890123456789012345678901234567890;
let $long_rep= $long_rep,$long_rep;
let $long_rep= $long_rep,$long_rep;
let $long_rep= $long_rep,$long_rep;
let $long_rep= $long_rep,$long_rep;
let $long_rep= $long_rep,$long_rep;
# This tests from strings > 1024 (here 1311)
--replace_result $long_rep LONG_STRING
eval select "$long_rep" as x;
# ----------------------------------------------------------------------------
# Test sync_with_master
......
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