diff options
author | unknown <hf@deer.(none)> | 2004-09-15 19:46:42 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2004-09-15 19:46:42 +0500 |
commit | d8a92015a2f1206f52b472d3c97decadfe96a084 (patch) | |
tree | f3d29dae0fcbf9fe95f668168b8b58040291b55a /myisam | |
parent | a7919046786d8d8d8230ac64af04cbbad1077aa2 (diff) | |
download | mariadb-git-d8a92015a2f1206f52b472d3c97decadfe96a084.tar.gz |
Fix for bug #5532 (error 22 inserting GIS data)
This bug is the result of weird error happening with mi_float8get and double
arythmetic. I described that in 'Bug that looks potentially dangerous' email
myisam/rt_mbr.c:
*ab_area was changed with the local variable just to make the function
working without errors
mysql-test/r/gis.result:
appropriate test result
mysql-test/t/gis.test:
Test case
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/rt_mbr.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/myisam/rt_mbr.c b/myisam/rt_mbr.c index 7b556979904..c7fde674729 100644 --- a/myisam/rt_mbr.c +++ b/myisam/rt_mbr.c @@ -505,7 +505,7 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b, amax = korr_func(a+len); \ bmax = korr_func(b+len); \ a_area *= (((double)amax) - ((double)amin)); \ - *ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \ + loc_ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \ } #define RT_AREA_INC_GET(type, get_func, len)\ @@ -516,7 +516,7 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b, get_func(amax, a+len); \ get_func(bmax, b+len); \ a_area *= (((double)amax) - ((double)amin)); \ - *ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \ + loc_ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \ } /* @@ -526,6 +526,7 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b, uint key_length, double *ab_area) { double a_area= 1.0; + double loc_ab_area= 1.0; *ab_area= 1.0; for (; (int)key_length > 0; keyseg += 2) @@ -575,7 +576,7 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b, RT_AREA_INC_GET(double, mi_float8get, 8); break; case HA_KEYTYPE_END: - return *ab_area - a_area; + goto safe_end; default: return -1; } @@ -584,7 +585,9 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b, a+= keyseg_length; b+= keyseg_length; } - return *ab_area - a_area; +safe_end: + *ab_area= loc_ab_area; + return loc_ab_area - a_area; } #define RT_PERIM_INC_KORR(type, korr_func, len) \ |