Skip to content

Commit 5eb666a

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 01e656a commit 5eb666a

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
@@ -1194,6 +1194,8 @@ static int setup_relate_func(Geometry *g1, Geometry *g2,
11941194
}
11951195
else
11961196
func->repeat_expression(shape_a);
1197+
if (func->reserve_op_buffer(1))
1198+
return 1;
11971199
func->add_operation(op_matrix(nc%3), 1);
11981200
if (do_store_shapes)
11991201
{
@@ -1364,11 +1366,13 @@ longlong Item_func_spatial_precise_rel::val_int()
13641366
Gcalc_function::op_intersection, 2);
13651367
func.add_operation(Gcalc_function::op_internals, 1);
13661368
shape_a= func.get_next_expression_pos();
1367-
if ((null_value= g1.store_shapes(&trn)))
1369+
if ((null_value= g1.store_shapes(&trn)) ||
1370+
func.reserve_op_buffer(1))
13681371
break;
13691372
func.add_operation(Gcalc_function::op_internals, 1);
13701373
shape_b= func.get_next_expression_pos();
1371-
if ((null_value= g2.store_shapes(&trn)))
1374+
if ((null_value= g2.store_shapes(&trn)) ||
1375+
func.reserve_op_buffer(1))
13721376
break;
13731377
func.add_operation(Gcalc_function::v_find_t |
13741378
Gcalc_function::op_intersection, 2);
@@ -1603,6 +1607,8 @@ int Item_func_buffer::Transporter::single_point(double x, double y)
16031607
{
16041608
if (buffer_op == Gcalc_function::op_difference)
16051609
{
1610+
if (m_fn->reserve_op_buffer(1))
1611+
return 1;
16061612
m_fn->add_operation(Gcalc_function::op_false, 0);
16071613
return 0;
16081614
}

0 commit comments

Comments
 (0)