summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-05-30 12:45:49 +0200
committerantirez <antirez@gmail.com>2016-05-30 12:45:54 +0200
commit4eff3dc4e4a7ee4b45347789e8921fce31848cdb (patch)
tree1a02095d281ff116448d39479168d97f39267862 /deps
parentbafed3ddd65eb1537a9239111777563ed5e3edcf (diff)
downloadredis-4eff3dc4e4a7ee4b45347789e8921fce31848cdb.tar.gz
Fix GEORADIUS wrong output with radius > Earth radius.
Close #3266
Diffstat (limited to 'deps')
-rw-r--r--deps/geohash-int/geohash_helper.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/deps/geohash-int/geohash_helper.c b/deps/geohash-int/geohash_helper.c
index 4c3762faf..acfb34cde 100644
--- a/deps/geohash-int/geohash_helper.c
+++ b/deps/geohash-int/geohash_helper.c
@@ -89,6 +89,8 @@ int geohashBoundingBox(double longitude, double latitude, double radius_meters,
lonr = deg_rad(longitude);
latr = deg_rad(latitude);
+ if (radius_meters > EARTH_RADIUS_IN_METERS)
+ radius_meters = EARTH_RADIUS_IN_METERS;
double distance = radius_meters / EARTH_RADIUS_IN_METERS;
double min_latitude = latr - distance;
double max_latitude = latr + distance;