Commit 29f77d41 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw

Bug was introduced in this commit:

  commit: a9ca8198
      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.
parent aad0165c
......@@ -4961,3 +4961,15 @@ DROP TABLE t1;
#
# End of 10.3 tests
#
#
# Start of 10.4 tests
#
#
# MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
#
SELECT GROUP_CONCAT( UpdateXML( '<a>new year</a>', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f;
f
2019-01-01 00:00:00F}^i
#
# End of 10.4 tests
#
......@@ -1951,3 +1951,19 @@ DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
--echo #
SELECT GROUP_CONCAT( UpdateXML( '<a>new year</a>', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f;
--echo #
--echo # End of 10.4 tests
--echo #
......@@ -941,7 +941,7 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
(void) from->realloc(from_length);
return from;
}
if (to->realloc(from_length))
if (to->alloc(from_length))
return from; // Actually an error
if ((to->str_length=MY_MIN(from->str_length,from_length)))
memcpy(to->Ptr,from->Ptr,to->str_length);
......
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