|
1 |
| -/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. |
| 1 | +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. |
2 | 2 |
|
3 | 3 | This program is free software; you can redistribute it and/or modify
|
4 | 4 | it under the terms of the GNU General Public License as published by
|
@@ -447,6 +447,11 @@ int Gcalc_result_receiver::complete_shape()
|
447 | 447 | }
|
448 | 448 | else
|
449 | 449 | {
|
| 450 | + if (cur_shape == Gcalc_function::shape_point) |
| 451 | + { |
| 452 | + DBUG_RETURN(1); |
| 453 | + } |
| 454 | + |
450 | 455 | DBUG_ASSERT(cur_shape != Gcalc_function::shape_point);
|
451 | 456 | if (cur_shape == Gcalc_function::shape_hole ||
|
452 | 457 | cur_shape == Gcalc_function::shape_polygon)
|
@@ -1173,8 +1178,12 @@ int Gcalc_operation_reducer::get_polygon_result(res_point *cur,
|
1173 | 1178 | {
|
1174 | 1179 | DBUG_ENTER("Gcalc_operation_reducer::get_polygon_result");
|
1175 | 1180 | res_point *glue= cur->glue;
|
1176 |
| - glue->up->down= NULL; |
1177 |
| - free_result(glue); |
| 1181 | + if(glue) |
| 1182 | + { |
| 1183 | + if(glue->up) |
| 1184 | + glue->up->down= NULL; |
| 1185 | + free_result(glue); |
| 1186 | + } |
1178 | 1187 | DBUG_RETURN(get_result_thread(cur, storage, 1) ||
|
1179 | 1188 | storage->complete_shape());
|
1180 | 1189 | }
|
@@ -1261,10 +1270,21 @@ int Gcalc_operation_reducer::get_result(Gcalc_result_receiver *storage)
|
1261 | 1270 | DBUG_ENTER("Gcalc_operation_reducer::get_result");
|
1262 | 1271 | Dynamic_array<Gcalc_result_receiver::chunk_info> chunks;
|
1263 | 1272 | bool polygons_found= false;
|
| 1273 | + int counter= 0; |
1264 | 1274 |
|
1265 | 1275 | *m_res_hook= NULL;
|
1266 | 1276 | while (m_result)
|
1267 | 1277 | {
|
| 1278 | + /** |
| 1279 | + Handle cyclic graph scenario. This can occur due to invalid input |
| 1280 | + geometry. Ideally the comparison should be with length of the string. |
| 1281 | + We have choosen an arbitory number suitable for practical usecase's |
| 1282 | + due to the complexity involved in checking with the length. |
| 1283 | + */ |
| 1284 | + counter++; |
| 1285 | + if (counter > 10000) |
| 1286 | + DBUG_RETURN(1); |
| 1287 | + |
1268 | 1288 | Gcalc_function::shape_type shape;
|
1269 | 1289 | Gcalc_result_receiver::chunk_info chunk;
|
1270 | 1290 |
|
|
0 commit comments