Commit ce848454 authored by unknown's avatar unknown

Fix of MDEV-565: Server crashes in ha_cassandra::write_row on inserting NULL into a dynamic column

Fixed incorrect initialization of variable which caused freeing memory by random address in case of error.
parent 703d82c4
...@@ -546,3 +546,12 @@ insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); ...@@ -546,3 +546,12 @@ insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a');
ERROR HY000: Encountered illegal format of dynamic column string ERROR HY000: Encountered illegal format of dynamic column string
delete from t1; delete from t1;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-565: Server crashes in ha_cassandra::write_row on
# inserting NULL into a dynamic column
#
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
insert into t1 values (1, NULL);
delete from t1;
DROP TABLE t1;
...@@ -634,6 +634,16 @@ insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); ...@@ -634,6 +634,16 @@ insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a');
delete from t1; delete from t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-565: Server crashes in ha_cassandra::write_row on
--echo # inserting NULL into a dynamic column
--echo #
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
insert into t1 values (1, NULL);
delete from t1;
DROP TABLE t1;
############################################################################ ############################################################################
## Cassandra cleanup ## Cassandra cleanup
......
...@@ -12,6 +12,8 @@ SET(cassandra_sources ...@@ -12,6 +12,8 @@ SET(cassandra_sources
gen-cpp/Cassandra.h) gen-cpp/Cassandra.h)
#INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) #INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
#INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift)
INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/)
# #
......
...@@ -1978,7 +1978,7 @@ int ha_cassandra::write_row(uchar *buf) ...@@ -1978,7 +1978,7 @@ int ha_cassandra::write_row(uchar *buf)
{ {
String valcol; String valcol;
DYNAMIC_ARRAY vals, names; DYNAMIC_ARRAY vals, names;
char *free_names; char *free_names= NULL;
int rc; int rc;
DBUG_ASSERT(field_converters[i] == NULL); DBUG_ASSERT(field_converters[i] == NULL);
if (!(rc= read_dyncol(&vals, &names, &valcol, &free_names))) if (!(rc= read_dyncol(&vals, &names, &valcol, &free_names)))
......
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