diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 0a8e53f6bab..a39729c26ae 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -5453,4 +5453,10 @@ t2 CREATE TABLE `t2` ( `c` polygon DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; +# +# MDEV-33987 Server crashes at Item_func_as_wkt::val_str_ascii +# +SELECT ST_ASTEXT(BOUNDARY(INET6_ATON('255.255.255.255'))) AS c1; +c1 +NULL # End of 10.5 tests diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 97938d106e1..eebb4620630 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -3456,4 +3456,12 @@ create table t2 as select group_concat(c, c order by 1,2), concat(c), c from t1; show create table t2; drop table t1, t2; + +--echo # +--echo # MDEV-33987 Server crashes at Item_func_as_wkt::val_str_ascii +--echo # + +SELECT ST_ASTEXT(BOUNDARY(INET6_ATON('255.255.255.255'))) AS c1; + + --echo # End of 10.5 tests diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 86965bcfe78..8546456a360 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -452,7 +452,7 @@ String *Item_func_boundary::val_str(String *str_value) Transporter trn(&res_receiver); Geometry *g= Geometry::construct(&buffer, swkb->ptr(), swkb->length()); - if (!g) + if ((null_value= !g)) DBUG_RETURN(0); if (g->store_shapes(&trn))