diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2014-12-31 19:52:35 -0500 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2014-12-31 19:52:35 -0500 |
commit | 61f73d40cab40994a1baaacc87c9e81d8e335975 (patch) | |
tree | 8ff2b8bd735e735c93071c7dc02d4201a9c75e71 | |
parent | dc92032fa33cc1f3bc7fb0f885433826246bcdc0 (diff) | |
download | mariadb-git-61f73d40cab40994a1baaacc87c9e81d8e335975.tar.gz |
MDEV-7397: SIGSEGV on inserting into a key-less table
When wsrep is enabled, an md5 hash of the entire row is calculated
for tables with no PK. It, however segfaulted as the md5 context
object was not properly constructed.
Fixed by ensuring that the YaSSL's context object gets constructed
explicitly at the specified pre-allocated location (placement)
before its used.
Added a test case.
-rw-r--r-- | mysql-test/suite/wsrep/r/basic.result | 17 | ||||
-rw-r--r-- | mysql-test/suite/wsrep/t/basic.test | 22 | ||||
-rw-r--r-- | mysys_ssl/my_md5.cc | 1 |
3 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/suite/wsrep/r/basic.result b/mysql-test/suite/wsrep/r/basic.result index d4efe348b61..6f8b65de166 100644 --- a/mysql-test/suite/wsrep/r/basic.result +++ b/mysql-test/suite/wsrep/r/basic.result @@ -27,4 +27,21 @@ c1 4 5 DROP TABLE t1; +# +# MDEV-7397: SIGSEGV on inserting into a key-less table +# + +# On node_1 +USE test; +CREATE TABLE t1(c1 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1; +c1 +1 + +# On node_2 +SELECT * FROM test.t1; +c1 +1 +DROP TABLE t1; # End of test diff --git a/mysql-test/suite/wsrep/t/basic.test b/mysql-test/suite/wsrep/t/basic.test index 8fc6eee3b3b..ad220f96f55 100644 --- a/mysql-test/suite/wsrep/t/basic.test +++ b/mysql-test/suite/wsrep/t/basic.test @@ -22,5 +22,27 @@ SELECT * FROM test.t1; # Cleanup DROP TABLE t1; +--echo # +--echo # MDEV-7397: SIGSEGV on inserting into a key-less table +--echo # + +--echo +--echo # On node_1 +--connection node_1 +USE test; +CREATE TABLE t1(c1 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1; + +--echo +--echo # On node_2 +--connection node_2 +SELECT * FROM test.t1; + +--let $galera_diff_statement = SELECT * FROM t1 +--source include/galera_diff.inc +# Cleanup +DROP TABLE t1; + --source include/galera_end.inc --echo # End of test diff --git a/mysys_ssl/my_md5.cc b/mysys_ssl/my_md5.cc index 697655244eb..875891abf57 100644 --- a/mysys_ssl/my_md5.cc +++ b/mysys_ssl/my_md5.cc @@ -34,6 +34,7 @@ typedef TaoCrypt::MD5 MD5_CTX; static void md5_init(MD5_CTX *context) { + context= new(context) MD5_CTX; context->Init(); } |