Skip to content

Commit 29f77d4

Browse files
committed
MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
Bug was introduced in this commit: commit: a9ca819 Call alloc() instead of realloc() Use alloc() if we don't need original string (avoid copy) Removed not needed test of str_length in sql_string.cc copy_if_not_alloced() was forgotten when changing realloc()'s to alloc()'s. Changing it now.
1 parent aad0165 commit 29f77d4

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

mysql-test/main/func_str.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4961,3 +4961,15 @@ DROP TABLE t1;
49614961
#
49624962
# End of 10.3 tests
49634963
#
4964+
#
4965+
# Start of 10.4 tests
4966+
#
4967+
#
4968+
# MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
4969+
#
4970+
SELECT GROUP_CONCAT( UpdateXML( '<a>new year</a>', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f;
4971+
f
4972+
2019-01-01 00:00:00F}^i
4973+
#
4974+
# End of 10.4 tests
4975+
#

mysql-test/main/func_str.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,3 +1951,19 @@ DROP TABLE t1;
19511951
--echo #
19521952
--echo # End of 10.3 tests
19531953
--echo #
1954+
1955+
1956+
--echo #
1957+
--echo # Start of 10.4 tests
1958+
--echo #
1959+
1960+
--echo #
1961+
--echo # MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
1962+
--echo #
1963+
1964+
SELECT GROUP_CONCAT( UpdateXML( '<a>new year</a>', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f;
1965+
1966+
1967+
--echo #
1968+
--echo # End of 10.4 tests
1969+
--echo #

sql/sql_string.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
941941
(void) from->realloc(from_length);
942942
return from;
943943
}
944-
if (to->realloc(from_length))
944+
if (to->alloc(from_length))
945945
return from; // Actually an error
946946
if ((to->str_length=MY_MIN(from->str_length,from_length)))
947947
memcpy(to->Ptr,from->Ptr,to->str_length);

0 commit comments

Comments
 (0)