MDEV-33987 Server crashes at Item_func_as_wkt::val_str_ascii

Item_func_boundary::val_str() did not set null_value when
it could not construct a geomery object from the input.
This commit is contained in:
Alexander Barkov 2024-11-14 11:35:36 +04:00
parent 8a3c53f32b
commit 13a14c0d78
3 changed files with 15 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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))