Skip to content
Permalink
Browse files
MDEV-16050 cte + geometry functions lead to crash.
Structures based on Gcalc_dyn_list need to be treated
properly when copied in Item::get_copy().
  • Loading branch information
Alexey Botchkov committed Sep 16, 2018
1 parent 7419f72 commit e89b611
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
@@ -505,6 +505,9 @@ GEOMETRYFROMTEXT('POINT(4599 60359)'),
) as relate_res;
relate_res
0
with cte1 as( select (st_symdifference(point(1,1),point(1,1))) as a1 ), cte2 as(select 1 as a2) select 1 from cte1 where cte1.a1 < '1';
1
1
DROP TABLE IF EXISTS p1;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN
@@ -381,5 +381,9 @@ SELECT ST_RELATE(
'F*FFFF**F'
) as relate_res;

# MDEV- 16050 cte + geometry functions lead to crash.

with cte1 as( select (st_symdifference(point(1,1),point(1,1))) as a1 ), cte2 as(select 1 as a2) select 1 from cte1 where cte1.a1 < '1';

--source include/gis_debug.inc

@@ -177,6 +177,17 @@ Gcalc_dyn_list::Gcalc_dyn_list(size_t blk_size, size_t sizeof_item):
{}


Gcalc_dyn_list::Gcalc_dyn_list(const Gcalc_dyn_list &dl)
{
m_blk_size= dl.m_blk_size;
m_sizeof_item= dl.m_sizeof_item;
m_points_per_blk= dl.m_points_per_blk;
m_blk_hook= &m_first_blk;
m_free= NULL;
m_keep= NULL;
}


void Gcalc_dyn_list::format_blk(void* block)
{
Item *pi_end, *cur_pi, *first_pi;
@@ -63,6 +63,7 @@ class Gcalc_dyn_list
};

Gcalc_dyn_list(size_t blk_size, size_t sizeof_item);
Gcalc_dyn_list(const Gcalc_dyn_list &dl);
~Gcalc_dyn_list();
Item *new_item()
{
@@ -229,6 +230,12 @@ class Gcalc_heap : public Gcalc_dyn_list
Gcalc_dyn_list(blk_size, sizeof(Info)),
m_hook(&m_first), m_n_points(0)
{}

Gcalc_heap(const Gcalc_heap &gh) :
Gcalc_dyn_list(gh),
m_hook(&m_first), m_n_points(0)
{}

void set_extent(double xmin, double xmax, double ymin, double ymax);
Info *new_point_info(double x, double y, gcalc_shape_info shape);
void free_point_info(Info *i, Gcalc_dyn_list::Item **i_hook);
@@ -663,6 +663,17 @@ Gcalc_operation_reducer::Gcalc_operation_reducer(size_t blk_size) :
{}


Gcalc_operation_reducer::Gcalc_operation_reducer(
const Gcalc_operation_reducer &gor) :
Gcalc_dyn_list(gor),
#ifndef GCALC_DBUG_OFF
n_res_points(0),
#endif /*GCALC_DBUG_OFF*/
m_res_hook((Gcalc_dyn_list::Item **)&m_result),
m_first_active_thread(NULL)
{}


void Gcalc_operation_reducer::init(Gcalc_function *fn, modes mode)
{
m_fn= fn;
@@ -224,6 +224,7 @@ class Gcalc_operation_reducer : public Gcalc_dyn_list
};

Gcalc_operation_reducer(size_t blk_size=8192);
Gcalc_operation_reducer(const Gcalc_operation_reducer &gor);
void init(Gcalc_function *fn, modes mode= default_mode);
Gcalc_operation_reducer(Gcalc_function *fn, modes mode= default_mode,
size_t blk_size=8192);

0 comments on commit e89b611

Please sign in to comment.