From 203729b88a7204e7d1e63991c882388ceb625c72 Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Sun, 6 May 2012 13:15:16 -0700 Subject: Fix a segfault in geoid computation. Problem found by: "Bywater, Rick (SA-1)" Patch by: Beat Bolli --- geoid.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/geoid.c b/geoid.c index a0feaf45..f055b373 100644 --- a/geoid.c +++ b/geoid.c @@ -72,12 +72,9 @@ double wgs84_separation(double lat, double lon) ilon = (int)floor((180. + lon) / 10); /* sanity checks to prevent segfault on bad data */ - if ((ilat > 90) || (ilat < -90)) { - return 0.0; - } - if ((ilon > 180) || (ilon < -180)) { - return 0.0; - } + if ((GEOID_ROW <= ilat) || (0 > ilat) || + (GEOID_COL <= ilon) || (0 > ilon)) + return 0.0; ilat1 = ilat; ilon1 = ilon; -- cgit v1.2.1