Bug #19573096: LOADING CORRUPTED GEOMETRY DATA INTO A

               MYISAM TABLE CAUSES THE SERVER TO CRASH

Issue:
-----
During index maintanence, R-tree node might need a split.
In some cases the square of mbr could be calculated to
infinite (as in this case) or to NaN. This is currently
not handled. This is specific to MyISAM.

SOLUTION:
---------
If the calculated value in "mbr_join_square" is infinite or
NaN, set it to max double value.

Initialization of output parameters of "pick_seeds" is
required if calculation is infinite (or negative infinite).

Similar to the fix made for INNODB as part of Bug#19533996.
parent 98b18c59
/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -68,6 +68,10 @@ static double mbr_join_square(const double *a, const double *b, int n_dim) ...@@ -68,6 +68,10 @@ static double mbr_join_square(const double *a, const double *b, int n_dim)
b += 2; b += 2;
}while (a != end); }while (a != end);
/* Check for infinity or NaN */
if (my_isinf(square) || isnan(square))
square = DBL_MAX;
return square; return square;
} }
...@@ -102,6 +106,9 @@ static void pick_seeds(SplitStruct *node, int n_entries, ...@@ -102,6 +106,9 @@ static void pick_seeds(SplitStruct *node, int n_entries,
double max_d = -DBL_MAX; double max_d = -DBL_MAX;
double d; double d;
*seed_a = node;
*seed_b = node + 1;
for (cur1 = node; cur1 < lim1; ++cur1) for (cur1 = node; cur1 < lim1; ++cur1)
{ {
for (cur2=cur1 + 1; cur2 < lim2; ++cur2) for (cur2=cur1 + 1; cur2 < lim2; ++cur2)
......
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