Commit e89b611d authored by Alexey Botchkov's avatar Alexey Botchkov

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().
parent 7419f72b
...@@ -505,6 +505,9 @@ GEOMETRYFROMTEXT('POINT(4599 60359)'), ...@@ -505,6 +505,9 @@ GEOMETRYFROMTEXT('POINT(4599 60359)'),
) as relate_res; ) as relate_res;
relate_res relate_res
0 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; DROP TABLE IF EXISTS p1;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT) CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN BEGIN
......
...@@ -381,5 +381,9 @@ SELECT ST_RELATE( ...@@ -381,5 +381,9 @@ SELECT ST_RELATE(
'F*FFFF**F' 'F*FFFF**F'
) as relate_res; ) 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 --source include/gis_debug.inc
...@@ -177,6 +177,17 @@ Gcalc_dyn_list::Gcalc_dyn_list(size_t blk_size, size_t sizeof_item): ...@@ -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) void Gcalc_dyn_list::format_blk(void* block)
{ {
Item *pi_end, *cur_pi, *first_pi; Item *pi_end, *cur_pi, *first_pi;
......
...@@ -63,6 +63,7 @@ class Gcalc_dyn_list ...@@ -63,6 +63,7 @@ class Gcalc_dyn_list
}; };
Gcalc_dyn_list(size_t blk_size, size_t sizeof_item); Gcalc_dyn_list(size_t blk_size, size_t sizeof_item);
Gcalc_dyn_list(const Gcalc_dyn_list &dl);
~Gcalc_dyn_list(); ~Gcalc_dyn_list();
Item *new_item() Item *new_item()
{ {
...@@ -229,6 +230,12 @@ class Gcalc_heap : public Gcalc_dyn_list ...@@ -229,6 +230,12 @@ class Gcalc_heap : public Gcalc_dyn_list
Gcalc_dyn_list(blk_size, sizeof(Info)), Gcalc_dyn_list(blk_size, sizeof(Info)),
m_hook(&m_first), m_n_points(0) 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); void set_extent(double xmin, double xmax, double ymin, double ymax);
Info *new_point_info(double x, double y, gcalc_shape_info shape); Info *new_point_info(double x, double y, gcalc_shape_info shape);
void free_point_info(Info *i, Gcalc_dyn_list::Item **i_hook); 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) : ...@@ -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) void Gcalc_operation_reducer::init(Gcalc_function *fn, modes mode)
{ {
m_fn= fn; m_fn= fn;
......
...@@ -224,6 +224,7 @@ class Gcalc_operation_reducer : public Gcalc_dyn_list ...@@ -224,6 +224,7 @@ class Gcalc_operation_reducer : public Gcalc_dyn_list
}; };
Gcalc_operation_reducer(size_t blk_size=8192); 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); void init(Gcalc_function *fn, modes mode= default_mode);
Gcalc_operation_reducer(Gcalc_function *fn, modes mode= default_mode, Gcalc_operation_reducer(Gcalc_function *fn, modes mode= default_mode,
size_t blk_size=8192); size_t blk_size=8192);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment