Skip to content

Commit ea4e8ba

Browse files
author
Alexey Botchkov
committed
MDEV-12705 10.1.18-MariaDB-1~jessie - mysqld got signal 11.
Space for the next operation wasn't reserved in Item_func_spatial_relate::val_str()
1 parent a659291 commit ea4e8ba

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

mysql-test/r/gis-precise.result

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,25 @@ ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText
486486
select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
487487
ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'))
488488
0
489+
SELECT ST_RELATE(
490+
ST_DIFFERENCE(
491+
GEOMETRYFROMTEXT('
492+
MULTILINESTRING(
493+
( 12841 36140, 8005 31007, 26555 31075, 52765 41191,
494+
28978 6548, 45720 32057, 53345 3221 ),
495+
( 8304 59107, 25233 31592, 40502 25303, 8205 42940 ),
496+
( 7829 7305, 58841 56759, 64115 8512, 37562 54145, 2210 14701 ),
497+
( 20379 2805, 40807 27770, 28147 14883, 26439 29383, 55663 5086 ),
498+
( 35944 64702, 14433 23728, 49317 26241, 790 16941 )
499+
)
500+
'),
501+
GEOMETRYFROMTEXT('POINT(46061 13545)')
502+
),
503+
GEOMETRYFROMTEXT('POINT(4599 60359)'),
504+
'F*FFFF**F'
505+
) as relate_res;
506+
relate_res
507+
0
489508
DROP TABLE IF EXISTS p1;
490509
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
491510
BEGIN

mysql-test/t/gis-precise.test

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,5 +362,24 @@ select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT
362362
select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
363363
select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
364364

365+
# MDEV-12705 10.1.18-MariaDB-1~jessie - mysqld got signal 11.
366+
SELECT ST_RELATE(
367+
ST_DIFFERENCE(
368+
GEOMETRYFROMTEXT('
369+
MULTILINESTRING(
370+
( 12841 36140, 8005 31007, 26555 31075, 52765 41191,
371+
28978 6548, 45720 32057, 53345 3221 ),
372+
( 8304 59107, 25233 31592, 40502 25303, 8205 42940 ),
373+
( 7829 7305, 58841 56759, 64115 8512, 37562 54145, 2210 14701 ),
374+
( 20379 2805, 40807 27770, 28147 14883, 26439 29383, 55663 5086 ),
375+
( 35944 64702, 14433 23728, 49317 26241, 790 16941 )
376+
)
377+
'),
378+
GEOMETRYFROMTEXT('POINT(46061 13545)')
379+
),
380+
GEOMETRYFROMTEXT('POINT(4599 60359)'),
381+
'F*FFFF**F'
382+
) as relate_res;
383+
365384
--source include/gis_debug.inc
366385

sql/item_geofunc.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,8 @@ static int setup_relate_func(Geometry *g1, Geometry *g2,
13321332
}
13331333
else
13341334
func->repeat_expression(shape_a);
1335+
if (func->reserve_op_buffer(1))
1336+
return 1;
13351337
func->add_operation(op_matrix(nc%3), 1);
13361338
if (do_store_shapes)
13371339
{
@@ -1502,11 +1504,13 @@ longlong Item_func_spatial_precise_rel::val_int()
15021504
Gcalc_function::op_intersection, 2);
15031505
func.add_operation(Gcalc_function::op_internals, 1);
15041506
shape_a= func.get_next_expression_pos();
1505-
if ((null_value= g1.store_shapes(&trn)))
1507+
if ((null_value= g1.store_shapes(&trn)) ||
1508+
func.reserve_op_buffer(1))
15061509
break;
15071510
func.add_operation(Gcalc_function::op_internals, 1);
15081511
shape_b= func.get_next_expression_pos();
1509-
if ((null_value= g2.store_shapes(&trn)))
1512+
if ((null_value= g2.store_shapes(&trn)) ||
1513+
func.reserve_op_buffer(1))
15101514
break;
15111515
func.add_operation(Gcalc_function::v_find_t |
15121516
Gcalc_function::op_intersection, 2);
@@ -1741,6 +1745,8 @@ int Item_func_buffer::Transporter::single_point(double x, double y)
17411745
{
17421746
if (buffer_op == Gcalc_function::op_difference)
17431747
{
1748+
if (m_fn->reserve_op_buffer(1))
1749+
return 1;
17441750
m_fn->add_operation(Gcalc_function::op_false, 0);
17451751
return 0;
17461752
}

0 commit comments

Comments
 (0)