summaryrefslogtreecommitdiff
path: root/mysql-test/t/constraints.test
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-05-14 14:01:15 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2019-07-30 10:39:12 +0200
commit999cce215fbee4d0bcdb8df920f460cfee46e41b (patch)
treed68a8ed4e1196362ff7662bd1cd2e4cf4b220084 /mysql-test/t/constraints.test
parentd6886b95d0d48d80deffa7f2190b8abd5ee8236b (diff)
downloadmariadb-git-bb-10.2-MDEV-16932.tar.gz
MDEV-16932: ASAN heap-use-after-free in my_charlen_utf8 / my_well_formed_char_length_utf8 on 2nd execution of SP with ALTER trying to add bad CHECKbb-10.2-MDEV-16932
Make automatic name generation during execution (not prepare). Check result of memory allocation operation.
Diffstat (limited to 'mysql-test/t/constraints.test')
-rw-r--r--mysql-test/t/constraints.test37
1 files changed, 37 insertions, 0 deletions
diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test
index 39b2eb52a9f..531e6bd804b 100644
--- a/mysql-test/t/constraints.test
+++ b/mysql-test/t/constraints.test
@@ -119,3 +119,40 @@ CREATE TABLE test.t (f int foo=bar check(f>0));
SHOW CREATE TABLE t;
DROP table test.t;
SET @@SQL_MODE=@OLD_SQL_MODE;
+
+--echo #
+--echo # MDEV-16932 - ASAN heap-use-after-free in my_charlen_utf8 /
+--echo # my_well_formed_char_length_utf8 on 2nd execution of SP with
+--echo # ALTER trying to add bad CHECK
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE PROCEDURE sp() ALTER TABLE t1 ADD CONSTRAINT CHECK (b > 0);
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+show create table t1;
+alter table t1 add column b int;
+CALL sp;
+show create table t1;
+CALL sp;
+show create table t1;
+# Cleanup
+DROP PROCEDURE sp;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT);
+CREATE PROCEDURE sp() ALTER TABLE t1 ADD CONSTRAINT CHECK (b > 0);
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+alter table t1 add column b int, add constraint check (b < 10);
+CALL sp;
+show create table t1;
+# Cleanup
+DROP PROCEDURE sp;
+DROP TABLE t1;
+
+--echo # End of 10.2 tests