summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-06-02 14:17:48 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-06-02 17:43:45 +0530
commitd5e8b4d7f97c7a15be5d58b6f088c4c64787a385 (patch)
tree2c4c567936ec88012e66269d507ebc7b90e8f4ea /plugin
parent6df2f2db11bf0a559db54e18315ad37e6a4d5573 (diff)
downloadmariadb-git-d5e8b4d7f97c7a15be5d58b6f088c4c64787a385.tar.gz
MDEV-22509: Server crashes in Field_inet6::store_inet6_null_with_warn / Field::maybe_null
For field with type INET, during EITS collection the min and max values are store in text representation in the statistical table. While retrieving the value from the statistical table, the value is stored back in the original field using binary form instead of text and this was resulting in the crash. Introduced 2 functions in the Field structure: 1) store_to_statistical_minmax_field 2) store_from_statistical_minmax_field
Diffstat (limited to 'plugin')
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.result14
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.test10
2 files changed, 24 insertions, 0 deletions
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.result
index 6d84d105c99..1cbedad1c3c 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.result
@@ -13,5 +13,19 @@ test.t1 analyze status OK
INSERT INTO t1 VALUES ('3::3');
DROP TABLE t1;
#
+# MDEV-22509: Server crashes in Field_inet6::store_inet6_null_with_warn / Field::maybe_null
+#
+CREATE TABLE t1 (a INT, b INET6 NOT NULL);
+INSERT INTO t1 VALUES (1,'::'),(2,'::');
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+SELECT t1.a from t1;
+a
+1
+2
+DROP TABLE t1;
+#
# End of 10.5 tests
#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.test
index fb092db6bc4..063581b12f5 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.test
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.test
@@ -15,5 +15,15 @@ INSERT INTO t1 VALUES ('3::3');
DROP TABLE t1;
--echo #
+--echo # MDEV-22509: Server crashes in Field_inet6::store_inet6_null_with_warn / Field::maybe_null
+--echo #
+
+CREATE TABLE t1 (a INT, b INET6 NOT NULL);
+INSERT INTO t1 VALUES (1,'::'),(2,'::');
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+SELECT t1.a from t1;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.5 tests
--echo #