Commit 232eb75b authored by unknown's avatar unknown

MDEV-4994: Crash in dynamic column API

Dynamic columns unittest fix.

Correct processing of empty string added to creation dynamic string procedure
List function of numeric format fixed when empty string passed.
Unit test calls changed to new ones.
Unit test added to cmake file.
parent edc1e919
......@@ -1618,15 +1618,22 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str,
if (!(columns_order= malloc(sizeof(void*)*column_count)))
return ER_DYNCOL_RESOURCE;
if (new_str)
if (new_str || str->str == 0)
{
if (dynamic_column_init_named(str,
fmt->fixed_hdr +
hdr->header_size +
hdr->nmpool_size +
hdr->data_size +
DYNCOL_SYZERESERVE))
goto err;
if (column_count)
{
if (dynamic_column_init_named(str,
fmt->fixed_hdr +
hdr->header_size +
hdr->nmpool_size +
hdr->data_size +
DYNCOL_SYZERESERVE))
goto err;
}
else
{
dynamic_column_initialize(str);
}
}
else
{
......@@ -2438,7 +2445,8 @@ mariadb_dyncol_list(DYNAMIC_COLUMN *str, uint *count, uint **nums)
uint i;
enum enum_dyncol_func_result rc;
(*nums)= 0; /* In case of errors */
(*nums)= 0; (*count)= 0; /* In case of errors */
if (str->length == 0)
return ER_DYNCOL_OK; /* no columns */
......
......@@ -20,6 +20,9 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql
MY_ADD_TESTS(bitmap base64 my_vsnprintf my_atomic my_rdtsc lf my_malloc
LINK_LIBRARIES mysys)
MY_ADD_TESTS(ma_dyncol
LINK_LIBRARIES mysqlclient)
IF(WIN32)
MY_ADD_TESTS(my_delete LINK_LIBRARIES mysys)
ENDIF()
......
This diff is collapsed.
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